Class HatchBrush

Class HatchBrush

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

Definisce un pennello rettangolare con uno stile di tratteggio, un colore di primo piano e un colore di sfondo. Questa classe non può essere ereditata.

[JsonObject(MemberSerialization.OptIn)]
public sealed class HatchBrush : Brush, IDisposable

Ereditarietà

objectDisposableObjectBrushHatchBrush

Implementa

IDisposable

Membri ereditati

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()

Esempi

Questo esempio mostra la creazione e l’uso degli oggetti Pen. L’esempio crea una nuova Immagine e disegna Rettangoli sulla superficie dell’Immagine.```csharp [C#]

                                                                                                                                   //Crea un'istanza di BmpOptions e imposta le sue varie proprietà
                                                                                                                                   Aspose.Imaging.ImageOptions.BmpOptions bmpOptions = new Aspose.Imaging.ImageOptions.BmpOptions();
                                                                                                                                   bmpOptions.BitsPerPixel = 24;

                                                                                                                                   //Crea un'istanza di FileCreateSource e assegnala come Fonte per l'istanza di BmpOptions
                                                                                                                                   //Il secondo parametro booleano determina se il file da creare è temporaneo o meno
                                                                                                                                   bmpOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(@"C:\temp\sample.bmp", false);

                                                                                                                                   //Crea un'istanza di Immagine nel percorso specificato
                                                                                                                                   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(bmpOptions, 500, 500))
                                                                                                                                   {
                                                                                                                                       //Crea un'istanza di Graphics e inizializzala con l'oggetto Immagine
                                                                                                                                       Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                       //Pulisci la superficie dei Graphics con il colore bianco
                                                                                                                                       graphics.Clear(Aspose.Imaging.Color.White);

                                                                                                                                       //Crea un'istanza di Pen con colore rosso e larghezza 5
                                                                                                                                       Aspose.Imaging.Pen pen = new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 5f);

                                                                                                                                       //Crea un'istanza di HatchBrush e imposta le sue proprietà
                                                                                                                                       Aspose.Imaging.Brushes.HatchBrush brush = new Aspose.Imaging.Brushes.HatchBrush();
                                                                                                                                       brush.BackgroundColor = Aspose.Imaging.Color.Wheat;
                                                                                                                                       brush.ForegroundColor = Aspose.Imaging.Color.Red;

                                                                                                                                       //Crea un'istanza di Pen
                                                                                                                                       //inizializzala con l'oggetto HatchBrush e la larghezza
                                                                                                                                       Aspose.Imaging.Pen brusedpen = new Pen(brush, 5);

                                                                                                                                       //Disegna rettangoli specificando l'oggetto Pen
                                                                                                                                       graphics.DrawRectangles(pen, new[]
                                                                                                                                       {
                                                                                                                                           new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(210, 210), new Aspose.Imaging.Size(100, 100)),
                                                                                                                                           new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(110, 110), new Aspose.Imaging.Size(100, 100)),
                                                                                                                                           new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(310, 310), new Aspose.Imaging.Size(100, 100))
                                                                                                                                       });

                                                                                                                                       //Disegna rettangoli specificando l'oggetto Pen
                                                                                                                                       graphics.DrawRectangles(brusedpen, new[]
                                                                                                                                       {
                                                                                                                                           new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(310, 110), new Aspose.Imaging.Size(100, 100)),
                                                                                                                                           new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(110, 310), new Aspose.Imaging.Size(100, 100))
                                                                                                                                       });

                                                                                                                                       // salva tutte le modifiche.
                                                                                                                                       image.Save();
                                                                                                                                   }

## Costruttori

### <a id="Aspose_Imaging_Brushes_HatchBrush__ctor"></a> HatchBrush\(\)

```csharp
public HatchBrush()

Proprietà

BackgroundColor

Ottiene o imposta il colore degli spazi tra le linee di tratteggio.

public Color BackgroundColor { get; set; }

Valore della Proprietà

Color

Esempi

Questo esempio mostra la creazione e l’uso degli oggetti Pen. L’esempio crea una nuova Immagine e disegna Rettangoli sulla superficie dell’Immagine.```csharp [C#]

                                                                                                                                   //Crea un'istanza di BmpOptions e imposta le sue varie proprietà
                                                                                                                                   Aspose.Imaging.ImageOptions.BmpOptions bmpOptions = new Aspose.Imaging.ImageOptions.BmpOptions();
                                                                                                                                   bmpOptions.BitsPerPixel = 24;

                                                                                                                                   //Crea un'istanza di FileCreateSource e assegnala come Fonte per l'istanza di BmpOptions
                                                                                                                                   //Il secondo parametro booleano determina se il file da creare è temporaneo o meno
                                                                                                                                   bmpOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(@"C:\temp\sample.bmp", false);

                                                                                                                                   //Crea un'istanza di Immagine nel percorso specificato
                                                                                                                                   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(bmpOptions, 500, 500))
                                                                                                                                   {
                                                                                                                                       //Crea un'istanza di Graphics e inizializzala con l'oggetto Immagine
                                                                                                                                       Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                       //Pulisci la superficie dei Graphics con il colore bianco
                                                                                                                                       graphics.Clear(Aspose.Imaging.Color.White);

                                                                                                                                       //Crea un'istanza di Pen con colore rosso e larghezza 5
                                                                                                                                       Aspose.Imaging.Pen pen = new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 5f);

                                                                                                                                       //Crea un'istanza di HatchBrush e imposta le sue proprietà
                                                                                                                                       Aspose.Imaging.Brushes.HatchBrush brush = new Aspose.Imaging.Brushes.HatchBrush();
                                                                                                                                       brush.BackgroundColor = Aspose.Imaging.Color.Wheat;
                                                                                                                                       brush.ForegroundColor = Aspose.Imaging.Color.Red;

                                                                                                                                       //Crea un'istanza di Pen
                                                                                                                                       //inizializzala con l'oggetto HatchBrush e la larghezza
                                                                                                                                       Aspose.Imaging.Pen brusedpen = new Pen(brush, 5);

                                                                                                                                       //Disegna rettangoli specificando l'oggetto Pen
                                                                                                                                       graphics.DrawRectangles(pen, new[]
                                                                                                                                       {
                                                                                                                                           new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(210, 210), new Aspose.Imaging.Size(100, 100)),
                                                                                                                                           new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(110, 110), new Aspose.Imaging.Size(100, 100)),
                                                                                                                                           new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(310, 310), new Aspose.Imaging.Size(100, 100))
                                                                                                                                       });

                                                                                                                                       //Disegna rettangoli specificando l'oggetto Pen
                                                                                                                                       graphics.DrawRectangles(brusedpen, new[]
                                                                                                                                       {
                                                                                                                                           new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(310, 110), new Aspose.Imaging.Size(100, 100)),
                                                                                                                                           new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(110, 310), new Aspose.Imaging.Size(100, 100))
                                                                                                                                       });

                                                                                                                                       // salva tutte le modifiche.
                                                                                                                                       image.Save();
                                                                                                                                   }

### <a id="Aspose_Imaging_Brushes_HatchBrush_ForegroundColor"></a> ForegroundColor

Ottiene o imposta il colore delle linee di tratteggio.

```csharp
public Color ForegroundColor { get; set; }

Valore della Proprietà

Color

Esempi

Questo esempio mostra la creazione e l’uso degli oggetti Pen. L’esempio crea una nuova Immagine e disegna Rettangoli sulla superficie dell’Immagine.```csharp [C#]

                                                                                                                                   //Crea un'istanza di BmpOptions e imposta le sue varie proprietà
                                                                                                                                   Aspose.Imaging.ImageOptions.BmpOptions bmpOptions = new Aspose.Imaging.ImageOptions.BmpOptions();
                                                                                                                                   bmpOptions.BitsPerPixel = 24;

                                                                                                                                   //Crea un'istanza di FileCreateSource e assegnala come Fonte per l'istanza di BmpOptions
                                                                                                                                   //Il secondo parametro booleano determina se il file da creare è temporaneo o meno
                                                                                                                                   bmpOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(@"C:\temp\sample.bmp", false);

                                                                                                                                   //Crea un'istanza di Immagine nel percorso specificato
                                                                                                                                   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(bmpOptions, 500, 500))
                                                                                                                                   {
                                                                                                                                       //Crea un'istanza di Graphics e inizializzala con l'oggetto Immagine
                                                                                                                                       Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                       //Pulisci la superficie dei Graphics con il colore bianco
                                                                                                                                       graphics.Clear(Aspose.Imaging.Color.White);

                                                                                                                                       //Crea un'istanza di Pen con colore rosso e larghezza 5
                                                                                                                                       Aspose.Imaging.Pen pen = new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 5f);

                                                                                                                                       //Crea un'istanza di HatchBrush e imposta le sue proprietà
                                                                                                                                       Aspose.Imaging.Brushes.HatchBrush brush = new Aspose.Imaging.Brushes.HatchBrush();
                                                                                                                                       brush.BackgroundColor = Aspose.Imaging.Color.Wheat;
                                                                                                                                       brush.ForegroundColor = Aspose.Imaging.Color.Red;

                                                                                                                                       //Crea un'istanza di Pen
                                                                                                                                       //inizializzala con l'oggetto HatchBrush e la larghezza
                                                                                                                                       Aspose.Imaging.Pen brusedpen = new Pen(brush, 5);

                                                                                                                                       //Disegna rettangoli specificando l'oggetto Pen
                                                                                                                                       graphics.DrawRectangles(pen, new[]
                                                                                                                                       {
                                                                                                                                           new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(210, 210), new Aspose.Imaging.Size(100, 100)),
                                                                                                                                           new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(110, 110), new Aspose.Imaging.Size(100, 100)),
                                                                                                                                           new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(310, 310), new Aspose.Imaging.Size(100, 100))
                                                                                                                                       });

                                                                                                                                       //Disegna rettangoli specificando l'oggetto Pen
                                                                                                                                       graphics.DrawRectangles(brusedpen, new[]
                                                                                                                                       {
                                                                                                                                           new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(310, 110), new Aspose.Imaging.Size(100, 100)),
                                                                                                                                           new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(110, 310), new Aspose.Imaging.Size(100, 100))
                                                                                                                                       });

                                                                                                                                       // salva tutte le modifiche.
                                                                                                                                       image.Save();
                                                                                                                                   }

### <a id="Aspose_Imaging_Brushes_HatchBrush_HatchStyle"></a> HatchStyle

Ottiene o imposta lo stile di tratteggio di questo pennello.

```csharp
public HatchStyle HatchStyle { get; set; }

Valore della Proprietà

HatchStyle

 Italiano