Difference between revisions of "Canvas line"
From Lazarus wiki
Jump to navigationJump to search (Fix coordinate of pixel in bottom/right corner of form. Avoid reference to form variable in form code.) |
(Dont paint in the OnClick event!) |
||
Line 8: | Line 8: | ||
This code will draw the diagonals in a form: | This code will draw the diagonals in a form: | ||
<syntaxhighlight> | <syntaxhighlight> | ||
− | procedure TForm1. | + | procedure TForm1.Form1Paint(Sender: TObject); |
begin | begin | ||
Canvas.Line(0, 0, Width-1, Height-1); | Canvas.Line(0, 0, Width-1, Height-1); |
Revision as of 17:47, 17 September 2018
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:
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;