RAD Studio VCL Reference
|
Draws a line on the canvas from PenPos to the point specified by X and Y, and sets the pen position to (X, Y).
procedure LineTo(X: Integer; Y: Integer);
__fastcall LineTo(int X, int Y);
Use LineTo to draw a line from PenPos up to, but not including the point (X,Y). LineTo changes the value of PenPos to (X,Y).
The line is drawn using Pen.
C++ Examples:
/* The following code draws a line from the upper left corner of a form to the mouse position when the mouse is moved, creating a "rubber band" effect. */ void __fastcall TForm1::FormMouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { /* first call FillRect to paint the surface of the form. this removes any previously drawn lines (and anything else!) */ Canvas->FillRect(ClientRect); Canvas->MoveTo(0, 0); Canvas->LineTo(X, Y); }
Delphi Examples:
{ The following code draws a line from the upper left corner of a form to the mouse position when the mouse is moved, creating a "rubber band" effect. } procedure TForm1.FormMouseMove( Sender: TObject; Shift: TShiftState; X, Y: Integer); begin { first call FillRect to paint the surface of the form. this removes any previously drawn lines (and anything else!) } Canvas.FillRect(ClientRect); Canvas.MoveTo(0, 0); Canvas.LineTo(X, Y); end;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|