HatchBrush 類別

定義

使用規劃樣式、前景色彩和背景色彩來定義矩形筆刷。Defines a rectangular brush with a hatch style, a foreground color, and a background color. 這個類別無法被繼承。This class cannot be inherited.

public ref class HatchBrush sealed : System::Drawing::Brush
public sealed class HatchBrush : System.Drawing.Brush
type HatchBrush = class
    inherit Brush
Public NotInheritable Class HatchBrush
Inherits Brush
繼承

範例

下列範例顯示如何建立上圖所示的 HatchBrushThe following example shows how to create the HatchBrush shown in the previous illustration.

HatchBrush hBrush = new HatchBrush(
   HatchStyle.Horizontal,
   Color.Red,
   Color.FromArgb(255, 128, 255, 255));
e.Graphics.FillEllipse(hBrush, 0, 0, 100, 60);
Dim hBrush As New HatchBrush( _
   HatchStyle.Horizontal, _
   Color.Red, _
   Color.FromArgb(255, 128, 255, 255))
e.Graphics.FillEllipse(hBrush, 0, 0, 100, 60)

備註

影線圖樣是由兩種色彩所組成:一個是由 BackgroundColor所定義,它會填滿背景,另一種則是在 ForegroundColor 屬性所定義的背景上形成圖樣的線條。A hatch pattern is made from two colors: one defined by the BackgroundColor, which fills the background and one for the lines that form the pattern over the background defined by the ForegroundColor property. HatchStyle 屬性會定義筆刷具有的模式類型,而且可以是來自 HatchStyle 列舉的任何值。The HatchStyle property defines what type of pattern the brush has and can be any value from the HatchStyle enumeration. HatchStyle 列舉中有超過50個元素。There are more than fifty elements in the HatchStyle enumeration.

下圖顯示以水準影線圖樣填滿的橢圓形。The following illustration shows an ellipse filled with a horizontal hatch pattern.

影線圖樣Hatch Pattern

建構函式

HatchBrush(HatchStyle, Color)

使用指定的 HatchBrush 列舉型別和前景色彩,初始化 HatchStyle 類別的新執行個體。Initializes a new instance of the HatchBrush class with the specified HatchStyle enumeration and foreground color.

HatchBrush(HatchStyle, Color, Color)

使用指定的 HatchBrush 列舉型別、前景色彩和背景色彩,初始化 HatchStyle 類別的新執行個體。Initializes a new instance of the HatchBrush class with the specified HatchStyle enumeration, foreground color, and background color.

屬性

BackgroundColor

取得由這個 HatchBrush 物件繪製的規劃線條之間的空間色彩。Gets the color of spaces between the hatch lines drawn by this HatchBrush object.

ForegroundColor

取得由這個 HatchBrush 物件繪製的規劃線條色彩。Gets the color of hatch lines drawn by this HatchBrush object.

HatchStyle

取得這個 HatchBrush 物件的規劃樣式。Gets the hatch style of this HatchBrush object.

方法

Clone()

建立這個 HatchBrush 物件的完全相同複本。Creates an exact copy of this HatchBrush object.

CreateObjRef(Type)

建立包含所有相關資訊的物件,這些資訊是產生用來與遠端物件通訊的所需 Proxy。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(繼承來源 MarshalByRefObject)
Dispose()

釋放這個 Brush 物件使用的所有資源。Releases all resources used by this Brush object.

(繼承來源 Brush)
Dispose(Boolean)

釋放 Brush 所使用的 unmanaged 資源並選擇性地釋放 managed 的資源。Releases the unmanaged resources used by the Brush and optionally releases the managed resources.

(繼承來源 Brush)
Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetHashCode()

作為預設雜湊函數。Serves as the default hash function.

(繼承來源 Object)
GetLifetimeService()

擷取控制這個執行個體存留期 (Lifetime) 原則的目前存留期服務物件。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(繼承來源 MarshalByRefObject)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
InitializeLifetimeService()

取得存留期服務物件,以控制這個執行個體的存留期原則。Obtains a lifetime service object to control the lifetime policy for this instance.

(繼承來源 MarshalByRefObject)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
MemberwiseClone(Boolean)

建立目前 MarshalByRefObject 物件的淺層複本。Creates a shallow copy of the current MarshalByRefObject object.

(繼承來源 MarshalByRefObject)
SetNativeBrush(IntPtr)

在衍生類別中,設定 GDI+GDI+ 筆刷物件的參考。In a derived class, sets a reference to a GDI+GDI+ brush object.

(繼承來源 Brush)
ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

適用於