Drawing with canvas/zh CN: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | leo_tecnologica@yahoo.com.ar 发布 —— Leonardo Gabriel Calautti | |
| 2 | 2 | ||
| 3 | 3 | **Line** (x1, y1, x2, y2)-\> 从(x1,y1)到(x2,y2)画线 | |
| 4 | 4 | ||
| 5 | 5 | **Rectangle** (x1, y1, x2, y2)-\> 从(x1,y1)点到(x2,y2)点画矩形 | |
| 6 | 6 | ||
| 7 | 7 | **Ellipse** (x1, y1, x2, y2)-\> 从(x1,y1)点到(x2,y2)点画椭圆 | |
| 8 | 8 | ||
| 9 | - | ||
| 10 | - | ||
| 11 | - | ||
| 12 | - | ||
| 9 | + |  | |
| 13 | 10 | ||
| 14 | 11 | 如,下面的代码,将绘制对角线,在Button1Click间: | |
| 15 | 12 | ||
| 16 | 13 | ``` pascal | |
| 17 | 14 | procedure TForm1.Button1Click(Sender: TObject); | |
| 18 | 15 | begin | |
| 19 | 16 | canvas.Line(0,0, form1.Width,form1.Height); | |
| 20 | 17 | canvas.Line(0,form1.height,form1.width,0); | |
| 21 | 18 | end; | |
| 22 | 19 | ``` | |
| 23 | 20 | ||
| 24 | 21 | 如何绘制矩形和椭圆在里面使用**Rectangle**和**Ellipse**;在调用Brush和Pen时,使用color设置颜色,该属性给绘制对象填充、线条的颜色。在绘制前,顺序很重要: | |
| 25 | 22 | ||
| 26 | 23 | ``` pascal | |
| 27 | 24 | canvas.Brush.color:= clred; | |
| 28 | 25 | canvas.Ellipse(195, 117, 205, 128); | |
| 29 | 26 | canvas.Brush.color:= clblue; | |
| 30 | 27 | canvas.Rectangle (192, 130,208,160); | |
| 31 | 28 | canvas.Brush.color:= clgreen; | |
| 32 | 29 | Canvas.Rectangle (187, 130,191,162); | |
| 33 | 30 | canvas.Brush.color:= clyellow; | |
| 34 | 31 | Canvas.Rectangle (209, 130,213,162); | |
| 35 | 32 | canvas.Brush.color:= clmaroon; | |
| 36 | 33 | Canvas.Rectangle (193,161,199,200); | |
| 37 | 34 | canvas.Brush.color:= clpurple; | |
| 38 | 35 | Canvas.Rectangle (201,161,207,200); | |
| 39 | 36 | ``` | |
| 40 | 37 | ||
| 41 | 38 | 如果按着步骤,你可以做到: | |
| 42 | 39 | ||
| 43 | - | ||
| 44 | - | ||
| 45 | - | ||
| 46 | - | ||
| 40 | + |  | |
| 47 | 41 | ||
| 48 | 42 | [[Graphics/zh CN|上一页]] | |
| 49 | 43 | ||
| 50 | 44 | --- | |
| 51 | 45 | *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).* | |
| 52 | 46 | Category: zh |
