EqualRect (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following code example returns whether two given TRect objects are equal in position and size.

Code

...
uses
  System.SysUtils, System.Types;

var
  aRect1: TRect;
  aRect2: TRect;

begin
    // Initialize the two rectangles
    aRect1 := Rect(1, 2, 6, 9);
    aRect2 := Rect(1, 2, 6, 9);
    // Compare them with the EqualRect function
    if EqualRect(aRect1, aRect2) then
      WriteLn('These rectangles are equal in position and size!')
    else
      WriteLn('These rectangles are not equal!');
    // But for TRect was owerloaded class operator Equal and we can use follow code:
    if aRect1 = aRect2 then
      WriteLn('Second example. These rectangles are equal in position and size!')
    else
      WriteLn('Second example. These rectangles are not equal!');
end.

Uses

Personal tools
Assistance