delphi怎么在窗体创建三角形代码
1个回答
展开全部
用moveto,lineto函数画三条首位相连的线就是三角形了,如
Image1.Canvas.MoveTo(100,100);
Image1.Canvas.LineTo(300,100);
Image1.Canvas.MoveTo(300,100);
Image1.Canvas.LineTo(300,300);
Image1.Canvas.MoveTo(300,300);
Image1.Canvas.LineTo(100,100);
这就在图片上画了个三角形了,当然还可以预先定义三个点,然后用Polygon函数连成一个多边形,三个点连成的肯定是三角形,如
var
PointA, PointB, PointC: TPoint;
begin
PointA := Point(200, 200);
PointB := Point(300, 80);
PointC := Point(400, 320);
Image1.Canvas.Polygon([PointA, PointB, PointC]);
end;
Image1.Canvas.MoveTo(100,100);
Image1.Canvas.LineTo(300,100);
Image1.Canvas.MoveTo(300,100);
Image1.Canvas.LineTo(300,300);
Image1.Canvas.MoveTo(300,300);
Image1.Canvas.LineTo(100,100);
这就在图片上画了个三角形了,当然还可以预先定义三个点,然后用Polygon函数连成一个多边形,三个点连成的肯定是三角形,如
var
PointA, PointB, PointC: TPoint;
begin
PointA := Point(200, 200);
PointB := Point(300, 80);
PointC := Point(400, 320);
Image1.Canvas.Polygon([PointA, PointB, PointC]);
end;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询