Description |
The PointsEqual function compares Point1 and Point2 parameter values and returns True if they are equal.
If either X or Y value of each point differs, then False is returned.
|
|
Related commands |
Bounds |
|
Create a TRect value from top left and size values |
Point |
|
Generates a TPoint value from X and Y values |
PtInRect |
|
Tests to see if a point lies within a rectangle |
Rect |
|
Create a TRect value from 2 points or 4 coordinates |
TPoint |
|
Holds X and Y integer values |
TRect |
|
Holds rectangle coordinate values |
|
|
|
|
Example code : Compare different and identical points |
// Full Unit code. // ----------------------------------------------------------- // You must store this code in a unit called Unit1 with a form // called Form1 that has an OnCreate event called FormCreate. unit Unit1; interface uses Classes, // Unit containing the PointsEqual command Types, Forms, Dialogs; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); end; var Form1: TForm1; implementation {$R *.dfm} // Include form definitions procedure TForm1.FormCreate(Sender: TObject); var
start, finish : TPoint;
begin // Set up the start and end points
start := Point(1, 2);
finish := Point(3, 4);
// Is the start point equal to the finish point?
if PointsEqual(start, finish)
then ShowMessage('1,2 = 3,4')
else ShowMessage('1,2 <> 3,4');
// Try using PointsEqual with identical values
if PointsEqual(Point(2,9), Point(2,9))
then ShowMessage('2,9 = 2,9')
else ShowMessage('2,9 <> 2,9');
end; end.
|
Hide full unit code |
1,2 <> 3,4
2,9 = 2,9
|
|