DelphiBasics
TPoint
Type
Holds X and Y integer values Types unit
  type TPoint = packed record
    X: Longint;
    Y: Longint;
  end;
Description
The TPoint type is a record type, holding X and Y integer values.
 
This is normally used to hold a 2 dimensional coordinate.
Related commands
Bounds Create a TRect value from top left and size values
Point Generates a TPoint value from X and Y values
PointsEqual Compares two TPoint values for equality
PtInRect Tests to see if a point lies within a rectangle
Rect Create a TRect value from 2 points or 4 coordinates
TRect Holds rectangle coordinate values
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 Download this web site as a Windows program.




 
Example code : Assign 2 TPoint variables manually and using Point
// 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
  Types,   // Unit containing the TPoint command
  Classes,
  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 point directly
  start.X := 1;
  start.Y := 2;

  // Set up the finish point using the Point method
  finish := Point(1, 2);

  // Is the start point equal to the finish point?
  if PointsEqual(start, finish)
  then ShowMessage('start =  finish')
  else ShowMessage('start <> finish');
end;
 
end.
Hide full unit code
   start =  finish
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Home Page