DelphiBasics
PointsEqual
Function
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
BoundsCreate a TRect value from top left and size values
PointGenerates a TPoint value from X and Y values
PtInRectTests to see if a point lies within a rectangle
RectCreate a TRect value from 2 points or 4 coordinates
TPointHolds X and Y integer values
TRectHolds rectangle coordinate values
 Download this web site as a Windows program.




 
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
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page