Drawing with canvas/de: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | - | ||
| 2 | 1 | Zurück zur Seite [[code examples/de|Code Beispiele]].\ | |
| 3 | - | ||
| 2 | + | ||
| 4 | 3 | veröffentlicht von leo_tecnologica@yahoo.com.ar --- Leonardo Gabriel Calautti\ | |
| 5 | 4 | * **Line** (x1, y1, x2, y2) -\> zieht eine Linie von Punkt (x1, y1) zu Punkt (x2, y2)\ | |
| 6 | 5 | * **Rectangle** (x1, y1, x2, y2) -\> zeichnet ein Rechteck mit einem Scheitelpunkt ausgehend vom Punkt (x1, y1) und dem gegenüberliegenden Punkt (x2, y2)\ | |
| 7 | 6 | * **Ellipse** (x1, y1, x2, y2) -\> zeichnet eine Ellipse in einem durch die Punkte (x1, y1) und (x2, y2) definierten Rechteck\ | |
| 8 | 7 |  | |
| 9 | 8 | ||
| 10 | 9 | Beispiel: Der folgende Code zeichnet zwei Diagonalen auf dem Formular: | |
| 11 | 10 | ||
| 12 | 11 | ``` pascal | |
| 13 | 12 | procedure TForm1.Form1Paint(Sender: TObject); | |
| 14 | 13 | begin | |
| 15 | 14 | Canvas.Line(0, 0, Width-1, Height-1); | |
| 16 | 15 | Canvas.Line(0, Height-1, Width-1, 0); | |
| 17 | 16 | end; | |
| 18 | 17 | ``` | |
| 19 | 18 | ||
| 20 | 19 | Wie kann man das Innere der Rechtecke und Ellipsen malen?\ | |
| 21 | 20 | Im Canvas-Objekt, gibt es ein Objekt namens'' `Brush` (Pinsel) und ein Objekt namens `Pen` (Stift), beide haben Farbeigenschaften (`Color`) für die Fläche und die Kontur der Objekte.\ | |
| 22 | 21 | Um ein Objekt in einer Farbe zu malen müssen die Eigenschaften von `Brush` und `Pen` entsprechend angepasst werden. | |
| 23 | 22 | ||
| 24 | 23 | ``` pascal | |
| 25 | 24 | Canvas.Brush.Color := clRed; | |
| 26 | 25 | Canvas.Ellipse(195, 117, 205, 128); | |
| 27 | 26 | Canvas.Brush.Color:= clBlue; | |
| 28 | 27 | Canvas.Rectangle (192, 130,208,160); | |
| 29 | 28 | Canvas.Brush.Color:= clGreen; | |
| 30 | 29 | Canvas.Rectangle (187, 130,191,162); | |
| 31 | 30 | Canvas.Brush.Color:= clYellow; | |
| 32 | 31 | Canvas.Rectangle (209, 130,213,162); | |
| 33 | 32 | Canvas.Brush.Color:= clMaroon; | |
| 34 | 33 | Canvas.Rectangle (193,161,199,200); | |
| 35 | 34 | Canvas.Brush.Color:= clPurple; | |
| 36 | 35 | Canvas.Rectangle (201,161,207,200); | |
| 37 | 36 | ``` | |
| 38 | 37 | ||
| 39 | - | ||
| 40 | 38 | Falls Sie die obenstehenden Schritte nachvollzogen haben, dann sehen Sie folgendes Bild:\ | |
| 41 | 39 |  | |
| 42 | 40 | ||
| 43 | 41 | --- | |
| 44 | 42 | *From the Free Pascal wiki, page "Drawing with canvas/de", 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).* |
