CenterPoint (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example illustrates how to use the CenterPoint routine to return the center point of a rectangle.

Code

#include <System.Types.hpp>

int _tmain(int argc, _TCHAR* argv[]) {
	TRect *aRectangle = new TRect(4, 5, 16, 25);
	// create TRect object with initialized values.
	TPoint *aPoint = new TPoint();

	*aPoint = CenterPoint(*aRectangle);
	// assigned aRectangle's center point coordinates to aPoint
	printf("aPoint.X=%d aPoint.Y=%d", aPoint->X, aPoint->Y);
	getchar();
	return 0;
}

Uses