TRectGetWidthGetHeight (C++)
Description
This example illustrates how to use the GetWidth and GetHeight methods to return the width and the height 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
aRectangle1->NormalizeRect();
printf("%d %d %d %d\n",aRectangle1->Left,aRectangle1->Top,aRectangle1->Right,aRectangle1->Bottom);
// The console will output: -5 8 7 21, representing the coordinates of the corners of aRectangle1 after normalization
aWidth= aRectangle1->GetWidth();
printf("%d \n",aWidth);
// The console will output: 12, representing the width of aRectangle1
aHeight = aRectangle1->GetHeight();
printf("%d \n",aHeight);
//The console will output: 13, representing the height of aRectangle1
return 0;
}