TRectGetSize (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example illustrates how to use the GetSize method to return the size of the rectangle.

Code

#include <tchar.h>
#include <stdio.h>
#include <system.types.hpp>

int _tmain(int argc, _TCHAR* argv[])
{
	TRect *aRectangle1 = new TRect(-5,21,7,8);
	printf("%d %d %d %d\n",aRectangle1->Left,aRectangle1->Top,aRectangle1->Right,aRectangle1->Bottom);
        // The console will output: -5 21 7 8, representing the coordinates of the corners of aRectangle1
        
        TSize aSize;
	aSize= aRectangle1->GetSize();
	printf("%d %d\n",aSize.Width, aSize.Height );
        // The console will output: 12 13 , representing the size of the rectangle in width and height
	return 0;
}

Uses