Class SolidBrush

Class SolidBrush

Namespace: Aspose.Imaging.Brushes
Assembly: Aspose.Imaging.dll (25.2.0)

Der Solid Brush ist zum kontinuierlichen Zeichnen mit einer bestimmten Farbe gedacht. Diese Klasse kann nicht vererbt werden.

public sealed class SolidBrush : Brush, IDisposable

Vererbung

objectDisposableObjectBrushSolidBrush

Implementiert

IDisposable

Vererbte Mitglieder

Brush.DeepClone(), Brush.Equals(object), Brush.GetHashCode(), Brush.Opacity, DisposableObject.Dispose(), DisposableObject.Disposed, object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Beispiele

Dieses Beispiel verwendet die Graphics-Klasse, um primitive Formen auf der Bildoberfläche zu erstellen. Um die Funktionsweise zu demonstrieren, erstellt das Beispiel ein neues Bild im PNG-Format und zeichnet primitive Formen auf der Bildoberfläche mit den von der Graphics-Klasse bereitgestellten Draw-Methoden.```csharp [C#]

                                                                                                                                                                                                                                                            //Erstellt eine Instanz von FileStream
                                                                                                                                                                                                                                                            using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
                                                                                                                                                                                                                                                            {
                                                                                                                                                                                                                                                                //Erstellt eine Instanz von PngOptions und setzt deren verschiedene Eigenschaften
                                                                                                                                                                                                                                                                Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();

                                                                                                                                                                                                                                                                //Setzt die Quelle für PngOptions
                                                                                                                                                                                                                                                                pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);

                                                                                                                                                                                                                                                                //Erstellt eine Instanz von Image 
                                                                                                                                                                                                                                                                using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
                                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                                    //Erstellt und initialisiert eine Instanz der Graphics-Klasse
                                                                                                                                                                                                                                                                    Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                                                                                                                                                    //Löscht die Grafikoberfläche
                                                                                                                                                                                                                                                                    graphics.Clear(Aspose.Imaging.Color.Wheat);

                                                                                                                                                                                                                                                                    //Zeichnet einen Bogen, indem das Pen-Objekt mit schwarzer Farbe, 
                                                                                                                                                                                                                                                                    //ein Rechteck, das den Bogen umgibt, der Startwinkel und der Sweep-Winkel angegeben werden
                                                                                                                                                                                                                                                                    graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);

                                                                                                                                                                                                                                                                    //Zeichnet eine Bezier-Kurve, indem das Pen-Objekt mit blauer Farbe und Koordinatenpunkten angegeben wird.
                                                                                                                                                                                                                                                                    graphics.DrawBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Point(250, 100), new Aspose.Imaging.Point(300, 30), new Aspose.Imaging.Point(450, 100), new Aspose.Imaging.Point(235, 25));

                                                                                                                                                                                                                                                                    //Zeichnet eine Kurve, indem das Pen-Objekt mit grüner Farbe und einem Array von Punkten angegeben wird
                                                                                                                                                                                                                                                                    graphics.DrawCurve(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new[] { new Aspose.Imaging.Point(100, 200), new Aspose.Imaging.Point(100, 350), new Aspose.Imaging.Point(200, 450) });

                                                                                                                                                                                                                                                                    //Zeichnet eine Ellipse mit dem Pen-Objekt und einem umgebenden Rechteck
                                                                                                                                                                                                                                                                    graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));

                                                                                                                                                                                                                                                                    //Zeichnet eine Linie 
                                                                                                                                                                                                                                                                    graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));

                                                                                                                                                                                                                                                                    //Zeichnet ein Tortensegment
                                                                                                                                                                                                                                                                    graphics.DrawPie(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Silver, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(200, 20), new Aspose.Imaging.Size(200, 200)), 0, 45);

                                                                                                                                                                                                                                                                    //Zeichnet ein Polygon, indem das Pen-Objekt mit roter Farbe und einem Array von Punkten angegeben wird
                                                                                                                                                                                                                                                                    graphics.DrawPolygon(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2), new[] { new Aspose.Imaging.Point(20, 100), new Aspose.Imaging.Point(20, 200), new Aspose.Imaging.Point(220, 20) });

                                                                                                                                                                                                                                                                    //Zeichnet ein Rechteck
                                                                                                                                                                                                                                                                    graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(250, 250), new Aspose.Imaging.Size(100, 100)));

                                                                                                                                                                                                                                                                    //Erstellt ein SolidBrush-Objekt und setzt dessen verschiedene Eigenschaften
                                                                                                                                                                                                                                                                    Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
                                                                                                                                                                                                                                                                    brush.Color = Color.Purple;
                                                                                                                                                                                                                                                                    brush.Opacity = 100;

                                                                                                                                                                                                                                                                    //Zeichnet einen String mit dem SolidBrush-Objekt und der Schriftart an einem bestimmten Punkt
                                                                                                                                                                                                                                                                    graphics.DrawString("Dieses Bild wurde mit der Aspose.Imaging API erstellt", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));

                                                                                                                                                                                                                                                                    //Speichert alle Änderungen.
                                                                                                                                                                                                                                                                    image.Save();
                                                                                                                                                                                                                                                                }
                                                                                                                                                                                                                                                            }

## Konstruktoren

### <a id="Aspose_Imaging_Brushes_SolidBrush__ctor"></a> SolidBrush\(\)

Initialisiert eine neue Instanz der Aspose.Imaging.Brushes.SolidBrush-Klasse.

```csharp
public SolidBrush()

Beispiele

Dieses Beispiel verwendet die Graphics-Klasse, um primitive Formen auf der Bildoberfläche zu erstellen. Um die Funktionsweise zu demonstrieren, erstellt das Beispiel ein neues Bild im PNG-Format und zeichnet primitive Formen auf der Bildoberfläche mit den von der Graphics-Klasse bereitgestellten Draw-Methoden.```csharp [C#]

                                                                                                                                                                                                                                                            //Erstellt eine Instanz von FileStream
                                                                                                                                                                                                                                                            using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
                                                                                                                                                                                                                                                            {
                                                                                                                                                                                                                                                                //Erstellt eine Instanz von PngOptions und setzt deren verschiedene Eigenschaften
                                                                                                                                                                                                                                                                Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();

                                                                                                                                                                                                                                                                //Setzt die Quelle für PngOptions
                                                                                                                                                                                                                                                                pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);

                                                                                                                                                                                                                                                                //Erstellt eine Instanz von Image 
                                                                                                                                                                                                                                                                using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
                                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                                    //Erstellt und initialisiert eine Instanz der Graphics-Klasse
                                                                                                                                                                                                                                                                    Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                                                                                                                                                    //Löscht die Grafikoberfläche
                                                                                                                                                                                                                                                                    graphics.Clear(Aspose.Imaging.Color.Wheat);

                                                                                                                                                                                                                                                                    //Zeichnet einen Bogen, indem das Pen-Objekt mit schwarzer Farbe, 
                                                                                                                                                                                                                                                                    //ein Rechteck, das den Bogen umgibt, der Startwinkel und der Sweep-Winkel angegeben werden
                                                                                                                                                                                                                                                                    graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);

                                                                                                                                                                                                                                                                    //Zeichnet eine Bezier-Kurve, indem das Pen-Objekt mit blauer Farbe und Koordinatenpunkten angegeben wird.
                                                                                                                                                                                                                                                                    graphics.DrawBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Point(250, 100), new Aspose.Imaging.Point(300, 30), new Aspose.Imaging.Point(450, 100), new Aspose.Imaging.Point(235, 25));

                                                                                                                                                                                                                                                                    //Zeichnet eine Kurve, indem das Pen-Objekt mit grüner Farbe und einem Array von Punkten angegeben wird
                                                                                                                                                                                                                                                                    graphics.DrawCurve(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new[] { new Aspose.Imaging.Point(100, 200), new Aspose.Imaging.Point(100, 350), new Aspose.Imaging.Point(200, 450) });

                                                                                                                                                                                                                                                                    //Zeichnet eine Ellipse mit dem Pen-Objekt und einem umgebenden Rechteck
                                                                                                                                                                                                                                                                    graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));

                                                                                                                                                                                                                                                                    //Zeichnet eine Linie 
                                                                                                                                                                                                                                                                    graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));

                                                                                                                                                                                                                                                                    //Zeichnet ein Tortensegment
                                                                                                                                                                                                                                                                    graphics.DrawPie(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Silver, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(200, 20), new Aspose.Imaging.Size(200, 200)), 0, 45);

                                                                                                                                                                                                                                                                    //Zeichnet ein Polygon, indem das Pen-Objekt mit roter Farbe und einem Array von Punkten angegeben wird
                                                                                                                                                                                                                                                                    graphics.DrawPolygon(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2), new[] { new Aspose.Imaging.Point(20, 100), new Aspose.Imaging.Point(20, 200), new Aspose.Imaging.Point(220, 20) });

                                                                                                                                                                                                                                                                    //Zeichnet ein Rechteck
                                                                                                                                                                                                                                                                    graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(250, 250), new Aspose.Imaging.Size(100, 100)));

                                                                                                                                                                                                                                                                    //Erstellt ein SolidBrush-Objekt und setzt dessen verschiedene Eigenschaften
                                                                                                                                                                                                                                                                    Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
                                                                                                                                                                                                                                                                    brush.Color = Color.Purple;
                                                                                                                                                                                                                                                                    brush.Opacity = 100;

                                                                                                                                                                                                                                                                    //Zeichnet einen String mit dem SolidBrush-Objekt und der Schriftart an einem bestimmten Punkt
                                                                                                                                                                                                                                                                    graphics.DrawString("Dieses Bild wurde mit der Aspose.Imaging API erstellt", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));

                                                                                                                                                                                                                                                                    //Speichert alle Änderungen.
                                                                                                                                                                                                                                                                    image.Save();
                                                                                                                                                                                                                                                                }
                                                                                                                                                                                                                                                            }

### <a id="Aspose_Imaging_Brushes_SolidBrush__ctor_Aspose_Imaging_Color_"></a> SolidBrush\(Color\)

Initialisiert eine neue Instanz der Aspose.Imaging.Brushes.SolidBrush-Klasse.

```csharp
public SolidBrush(Color color)

Parameter

color Color

Die Farbe des Solid Brush.

Eigenschaften

Color

Erhält oder setzt die Farbe des Pinsels.

[JsonProperty]
public Color Color { get; set; }

Eigenschaftswert

Color

Beispiele

Dieses Beispiel verwendet die Graphics-Klasse, um primitive Formen auf der Bildoberfläche zu erstellen. Um die Funktionsweise zu demonstrieren, erstellt das Beispiel ein neues Bild im PNG-Format und zeichnet primitive Formen auf der Bildoberfläche mit den von der Graphics-Klasse bereitgestellten Draw-Methoden.```csharp [C#]

                                                                                                                                                                                                                                                            //Erstellt eine Instanz von FileStream
                                                                                                                                                                                                                                                            using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
                                                                                                                                                                                                                                                            {
                                                                                                                                                                                                                                                                //Erstellt eine Instanz von PngOptions und setzt deren verschiedene Eigenschaften
                                                                                                                                                                                                                                                                Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();

                                                                                                                                                                                                                                                                //Setzt die Quelle für PngOptions
                                                                                                                                                                                                                                                                pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);

                                                                                                                                                                                                                                                                //Erstellt eine Instanz von Image 
                                                                                                                                                                                                                                                                using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
                                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                                    //Erstellt und initialisiert eine Instanz der Graphics-Klasse
                                                                                                                                                                                                                                                                    Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                                                                                                                                                    //Löscht die Grafikoberfläche
                                                                                                                                                                                                                                                                    graphics.Clear(Aspose.Imaging.Color.Wheat);

                                                                                                                                                                                                                                                                    //Zeichnet einen Bogen, indem das Pen-Objekt mit schwarzer Farbe, 
                                                                                                                                                                                                                                                                    //ein Rechteck, das den Bogen umgibt, der Startwinkel und der Sweep-Winkel angegeben werden
                                                                                                                                                                                                                                                                    graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);

                                                                                                                                                                                                                                                                    //Zeichnet eine Bezier-Kurve, indem das Pen-Objekt mit blauer Farbe und Koordinatenpunkten angegeben wird.
                                                                                                                                                                                                                                                                    graphics.DrawBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Point(250, 100), new Aspose.Imaging.Point(300, 30), new Aspose.Imaging.Point(450, 100), new Aspose.Imaging.Point(235, 25));

                                                                                                                                                                                                                                                                    //Zeichnet eine Kurve, indem das Pen-Objekt mit grüner Farbe und einem Array von Punkten angegeben wird
                                                                                                                                                                                                                                                                    graphics.DrawCurve(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new[] { new Aspose.Imaging.Point(100, 200), new Aspose.Imaging.Point(100, 350), new Aspose.Imaging.Point(200, 450) });

                                                                                                                                                                                                                                                                    //Zeichnet eine Ellipse mit dem Pen-Objekt und einem umgebenden Rechteck
                                                                                                                                                                                                                                                                    graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));

                                                                                                                                                                                                                                                                    //Zeichnet eine Linie 
                                                                                                                                                                                                                                                                    graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));

                                                                                                                                                                                                                                                                    //Zeichnet ein Tortensegment
                                                                                                                                                                                                                                                                    graphics.DrawPie(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Silver, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(200, 20), new Aspose.Imaging.Size(200, 200)), 0, 45);

                                                                                                                                                                                                                                                                    //Zeichnet ein Polygon, indem das Pen-Objekt mit roter Farbe und einem Array von Punkten angegeben wird
                                                                                                                                                                                                                                                                    graphics.DrawPolygon(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2), new[] { new Aspose.Imaging.Point(20, 100), new Aspose.Imaging.Point(20, 200), new Aspose.Imaging.Point(220, 20) });

                                                                                                                                                                                                                                                                    //Zeichnet ein Rechteck
                                                                                                                                                                                                                                                                    graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(250, 250), new Aspose.Imaging.Size(100, 100)));

                                                                                                                                                                                                                                                                    //Erstellt ein SolidBrush-Objekt und setzt dessen verschiedene Eigenschaften
                                                                                                                                                                                                                                                                    Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
                                                                                                                                                                                                                                                                    brush.Color = Color.Purple;
                                                                                                                                                                                                                                                                    brush.Opacity = 100;

                                                                                                                                                                                                                                                                    //Zeichnet einen String mit dem SolidBrush-Objekt und der Schriftart an einem bestimmten Punkt
                                                                                                                                                                                                                                                                    graphics.DrawString("Dieses Bild wurde mit der Aspose.Imaging API erstellt", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));

                                                                                                                                                                                                                                                                    //Speichert alle Änderungen.
                                                                                                                                                                                                                                                                    image.Save();
                                                                                                                                                                                                                                                                }
                                                                                                                                                                                                                                                            }
 Deutsch