IntersectRect (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following code example illustrates the usage of the IntersectRect function.

Code

#include <System.Types.hpp>

int _tmain(int argc, _TCHAR* argv[]) {
	TRect *aRectangle = new TRect(4, 8, 25, 36);
	TRect *aRectangle2 = new TRect(51, 48, 30, 44);
	TRect *resultRect = new TRect();

	if (IntersectRect(resultRect, aRectangle, aRectangle2)) 
		printf("The two rectangles overlap!");
	else
		printf("The two rectangles do not overlap!");
	getchar();
	return 0;
}

Uses