TRectBottomRight (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example illustrates how to use BottomRight method to return the lower-right point of the rectangle.

Code

uses
  System.SysUtils,
  System.Types;

var
  aRectangle : TRect;
  aPoint1,aPoint2: TPoint;
begin
    aPoint1.Create(1,4);
    aRectangle.Create(aPoint1,10,10);
    writeln(Format('%d %d %d %d',[aRectangle.Left,aRectangle.Top,aRectangle.Right,aRectangle.Bottom]));
    //The console will output: 1 4 11 14, representing the coordinates of the corners of aRectangle

    aPoint2:=aRectangle.BottomRight;
    writeln(Format('%d %d',[aPoint2.X,aPoint2.Y])); 
    //The console will output: 11 14, representing the coordinates of the aPoint2 , the lower-right point of the rectangle

end.

Uses