Bounds (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example illustrates how to use the Bounds routine to assign coordinates to a TRect object.

Code

uses
  System.SysUtils, System.Types;
var
  aRectangle:TRect;
...
begin
  try
    aRectangle := Bounds(4,5,16,25);
    {
    equivalent to:
      aRectangle.Left := 4;
      aRectangle.Top := 5;
      aRectangle.Width := 16;
      aRectangle.Height := 25;
    }
    WriteLn(aRectangle.Left,' ', aRectangle.Top, ' ',aRectangle.Right,' ',aRectangle.Bottom);
    //The console will output: 4 5 20 30, representing the coordinates for '''aRectangle'''.
end.

Uses