Canvas line

From Lazarus wiki
Revision as of 01:32, 7 February 2020 by Trev (talk | contribs) (Fixed syntax highlighting)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The Canvas.Line(x1, y1, x2, y2) statement will draw a line from point (x1, y1) to (x2, y2).

The coordinates of the canvas are:

canvas2.png


This code will draw the diagonals in a form:

procedure TForm1.Form1Paint(Sender: TObject);
begin
  Canvas.Line(0, 0, Width-1, Height-1);
  Canvas.Line(0, Height-1, Width-1 ,0);
end;

See also