Sign in Join
Wiki copytemporary

Drawing with canvas/zh CN: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11leo_tecnologica@yahoo.com.ar 发布 —— Leonardo Gabriel Calautti
22
33**Line** (x1, y1, x2, y2)-\> 从(x1,y1)到(x2,y2)画线
44
55**Rectangle** (x1, y1, x2, y2)-\> 从(x1,y1)点到(x2,y2)点画矩形
66
77**Ellipse** (x1, y1, x2, y2)-\> 从(x1,y1)点到(x2,y2)点画椭圆
88
9-<figure>
10-<img src="canvas2.png" title="canvas2.png" />
11-<figcaption>canvas2.png</figcaption>
12-</figure>
9+![](/wiki-images/d/d7/Canvas2.png)
1310
1411如,下面的代码,将绘制对角线,在Button1Click间:
1512
1613``` pascal
1714procedure TForm1.Button1Click(Sender: TObject);
1815begin
1916 canvas.Line(0,0, form1.Width,form1.Height);
2017 canvas.Line(0,form1.height,form1.width,0);
2118end;
2219```
2320
2421如何绘制矩形和椭圆在里面使用**Rectangle**和**Ellipse**;在调用Brush和Pen时,使用color设置颜色,该属性给绘制对象填充、线条的颜色。在绘制前,顺序很重要:
2522
2623``` pascal
2724 canvas.Brush.color:= clred;
2825 canvas.Ellipse(195, 117, 205, 128);
2926 canvas.Brush.color:= clblue;
3027 canvas.Rectangle (192, 130,208,160);
3128 canvas.Brush.color:= clgreen;
3229 Canvas.Rectangle (187, 130,191,162);
3330 canvas.Brush.color:= clyellow;
3431 Canvas.Rectangle (209, 130,213,162);
3532 canvas.Brush.color:= clmaroon;
3633 Canvas.Rectangle (193,161,199,200);
3734 canvas.Brush.color:= clpurple;
3835 Canvas.Rectangle (201,161,207,200);
3936```
4037
4138如果按着步骤,你可以做到:
4239
43-<figure>
44-<img src="canvas3.png" title="canvas3.png" />
45-<figcaption>canvas3.png</figcaption>
46-</figure>
40+![](/wiki-images/5/57/Canvas3.png)
4741
4842[[Graphics/zh CN|上一页]]
4943
5044---
5145*From the Free Pascal wiki, page "Drawing with canvas/zh CN", as it stood on 2020-02-14 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
5246Category: zh

Back to history