Timage Canvas画图

procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
begin
i:=0;
With Image1.Canvas Do
Begin
Pen.Color:=clWindowFrame ;
pen.=1;
rectangle(0,0,image1.Width,image1.Height);
Pen.Color:=clBlack;
Pen.Width:=2;
MoveTo(20,20); // 画坐标轴
lineto(20,image1.Height-20);
lineto(image1.width-20,image1.Height-20);

MoveTo(20,20); // 画y箭头
lineto(20-5,20+10);
moveto(20,20);
lineto(20+5,20+10);

MoveTo(image1.width-20,image1.Height-20); // 画x箭头
lineto(image1.width-20-10,image1.Height-20+5);
MoveTo(image1.width-20,image1.Height-20);
lineto(image1.width-20-10,image1.Height-20-5);

textout(10,image1.Height-25,'0');

Pen.Color:=clBlack; //画轴线
pen.Style:=psDot;
Pen.Width:=1;
while image1.Height-40-10*i>15 do begin
inc(i);
MoveTo(20,image1.Height-20-10*i);
lineto(image1.Width-20-20,image1.Height-20-10*i);
if (i mod 5)=0 then textout(10,image1.Height-20-10*i-5,inttostr(i));
end;


end;
end;

原文地址:https://www.cnblogs.com/cinemaparadiso/p/13545696.html