Class HatchBrush

Class HatchBrush

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

ハッチスタイル、前景色、背景色を持つ矩形ブラシを定義します。このクラスは継承できません。

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

継承

objectDisposableObjectBrushHatchBrush

実装

IDisposable

継承されたメンバー

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

この例では、Penオブジェクトの作成と使用を示します。この例では、新しい画像を作成し、画像の表面に矩形を描画します。```csharp [C#]

                                                                                                                                   //BmpOptionsのインスタンスを作成し、さまざまなプロパティを設定します
                                                                                                                                   Aspose.Imaging.ImageOptions.BmpOptions bmpOptions = new Aspose.Imaging.ImageOptions.BmpOptions();
                                                                                                                                   bmpOptions.BitsPerPixel = 24;

                                                                                                                                   //FileCreateSourceのインスタンスを作成し、BmpOptionsのインスタンスのソースとして割り当てます
                                                                                                                                   //2番目のBooleanパラメーターは、作成されるファイルが一時的かどうかを決定します
                                                                                                                                   bmpOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(@"C:\temp\sample.bmp", false);

                                                                                                                                   //指定されたパスで画像のインスタンスを作成します
                                                                                                                                   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(bmpOptions, 500, 500))
                                                                                                                                   {
                                                                                                                                       //Graphicsのインスタンスを作成し、画像オブジェクトで初期化します
                                                                                                                                       Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                       //白色でGraphics表面をクリアします
                                                                                                                                       graphics.Clear(Aspose.Imaging.Color.White);

                                                                                                                                       //赤色で幅5のPenのインスタンスを作成します
                                                                                                                                       Aspose.Imaging.Pen pen = new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 5f);

                                                                                                                                       //HatchBrushのインスタンスを作成し、そのプロパティを設定します
                                                                                                                                       Aspose.Imaging.Brushes.HatchBrush brush = new Aspose.Imaging.Brushes.HatchBrush();
                                                                                                                                       brush.BackgroundColor = Aspose.Imaging.Color.Wheat;
                                                                                                                                       brush.ForegroundColor = Aspose.Imaging.Color.Red;

                                                                                                                                       //Penのインスタンスを作成します
                                                                                                                                       //HatchBrushオブジェクトと幅で初期化します
                                                                                                                                       Aspose.Imaging.Pen brusedpen = new Pen(brush, 5);

                                                                                                                                       //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))
                                                                                                                                       });

                                                                                                                                       //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))
                                                                                                                                       });

                                                                                                                                       //すべての変更を保存します。
                                                                                                                                       image.Save();
                                                                                                                                   }

## コンストラクタ

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

```csharp
public HatchBrush()

プロパティ

BackgroundColor

ハッチ線の間のスペースの色を取得または設定します。

public Color BackgroundColor { get; set; }

プロパティ値

Color

この例では、Penオブジェクトの作成と使用を示します。この例では、新しい画像を作成し、画像の表面に矩形を描画します。```csharp [C#]

                                                                                                                                   //BmpOptionsのインスタンスを作成し、さまざまなプロパティを設定します
                                                                                                                                   Aspose.Imaging.ImageOptions.BmpOptions bmpOptions = new Aspose.Imaging.ImageOptions.BmpOptions();
                                                                                                                                   bmpOptions.BitsPerPixel = 24;

                                                                                                                                   //FileCreateSourceのインスタンスを作成し、BmpOptionsのインスタンスのソースとして割り当てます
                                                                                                                                   //2番目のBooleanパラメーターは、作成されるファイルが一時的かどうかを決定します
                                                                                                                                   bmpOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(@"C:\temp\sample.bmp", false);

                                                                                                                                   //指定されたパスで画像のインスタンスを作成します
                                                                                                                                   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(bmpOptions, 500, 500))
                                                                                                                                   {
                                                                                                                                       //Graphicsのインスタンスを作成し、画像オブジェクトで初期化します
                                                                                                                                       Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                       //白色でGraphics表面をクリアします
                                                                                                                                       graphics.Clear(Aspose.Imaging.Color.White);

                                                                                                                                       //赤色で幅5のPenのインスタンスを作成します
                                                                                                                                       Aspose.Imaging.Pen pen = new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 5f);

                                                                                                                                       //HatchBrushのインスタンスを作成し、そのプロパティを設定します
                                                                                                                                       Aspose.Imaging.Brushes.HatchBrush brush = new Aspose.Imaging.Brushes.HatchBrush();
                                                                                                                                       brush.BackgroundColor = Aspose.Imaging.Color.Wheat;
                                                                                                                                       brush.ForegroundColor = Aspose.Imaging.Color.Red;

                                                                                                                                       //Penのインスタンスを作成します
                                                                                                                                       //HatchBrushオブジェクトと幅で初期化します
                                                                                                                                       Aspose.Imaging.Pen brusedpen = new Pen(brush, 5);

                                                                                                                                       //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))
                                                                                                                                       });

                                                                                                                                       //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))
                                                                                                                                       });

                                                                                                                                       //すべての変更を保存します。
                                                                                                                                       image.Save();
                                                                                                                                   }

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

ハッチ線の色を取得または設定します。

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

プロパティ値

Color

この例では、Penオブジェクトの作成と使用を示します。この例では、新しい画像を作成し、画像の表面に矩形を描画します。```csharp [C#]

                                                                                                                                   //BmpOptionsのインスタンスを作成し、さまざまなプロパティを設定します
                                                                                                                                   Aspose.Imaging.ImageOptions.BmpOptions bmpOptions = new Aspose.Imaging.ImageOptions.BmpOptions();
                                                                                                                                   bmpOptions.BitsPerPixel = 24;

                                                                                                                                   //FileCreateSourceのインスタンスを作成し、BmpOptionsのインスタンスのソースとして割り当てます
                                                                                                                                   //2番目のBooleanパラメーターは、作成されるファイルが一時的かどうかを決定します
                                                                                                                                   bmpOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(@"C:\temp\sample.bmp", false);

                                                                                                                                   //指定されたパスで画像のインスタンスを作成します
                                                                                                                                   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(bmpOptions, 500, 500))
                                                                                                                                   {
                                                                                                                                       //Graphicsのインスタンスを作成し、画像オブジェクトで初期化します
                                                                                                                                       Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

                                                                                                                                       //白色でGraphics表面をクリアします
                                                                                                                                       graphics.Clear(Aspose.Imaging.Color.White);

                                                                                                                                       //赤色で幅5のPenのインスタンスを作成します
                                                                                                                                       Aspose.Imaging.Pen pen = new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 5f);

                                                                                                                                       //HatchBrushのインスタンスを作成し、そのプロパティを設定します
                                                                                                                                       Aspose.Imaging.Brushes.HatchBrush brush = new Aspose.Imaging.Brushes.HatchBrush();
                                                                                                                                       brush.BackgroundColor = Aspose.Imaging.Color.Wheat;
                                                                                                                                       brush.ForegroundColor = Aspose.Imaging.Color.Red;

                                                                                                                                       //Penのインスタンスを作成します
                                                                                                                                       //HatchBrushオブジェクトと幅で初期化します
                                                                                                                                       Aspose.Imaging.Pen brusedpen = new Pen(brush, 5);

                                                                                                                                       //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))
                                                                                                                                       });

                                                                                                                                       //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))
                                                                                                                                       });

                                                                                                                                       //すべての変更を保存します。
                                                                                                                                       image.Save();
                                                                                                                                   }

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

このブラシのハッチスタイルを取得または設定します。

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

プロパティ値

HatchStyle

 日本語