procedure TForm1.FormPaint(Sender: TObject);
var
trect1:trect;
begin
canvas.Pen.Color:=clred;
//canvas.Pen.Width:=1; //指定画笔的宽度
//canvas.Pen.Style:=psDashDotDot;//指定画笔的样式
with canvas do
begin
pen.color:=clnavy;
//画折线
polyline([Point(120,10),Point(80,110),Point(180,50),Point(60,50),Point(160,110),Point(120,10)]);
pen.Color:=clred;
//arc绘制弧形曲线
arc(220,10,420,110,220,10,420,10);
//moveto作用是将画笔移到指定位置
moveto(100,160);
//lineto画一条到指定位置的直线段,线段起始位置由画布对象的Penpos属性值即画笔的当前位置确定。
lineto(10,250);
pen.color:=clolive;
//画圆或者椭圆
ellipse(110,160,300,250);
pen.color:=clteal;
//roundrect圆角矩形
roundrect(310,160,400,250,50,240);
pen.Color:=clblue;
//rectangle绘制矩形
rectangle(410,160,500,250);
pen.Color:=clYellow;
Textout(100,250,'Delphi,你好');
trect1.Left:=220;
trect1.Top:=250;
TextRect(trect1,230,320,'Delphi中的画笔');
end;
end;