Canvas line

From Lazarus wiki
Revision as of 22:09, 5 November 2016 by BlaiseP (talk | contribs)
Jump to navigationJump to search

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.Button1Click(Sender: TObject);
begin
  canvas.Line(0,0, form1.Width,form1.Height);
  canvas.Line(0,form1.height,form1.width,0);
end;

See also