Mega Code Archive

 
Categories / Delphi / Functions
 

Pointsequal - compares two tpoint values for equality classes unit

function PointsEqual ( const Point1, Point2 : TPoint ) : Boolean; 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 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; Show full unit code 1,2 <> 3,4 2,9 = 2,9