HatchBrush HatchBrush HatchBrush HatchBrush Class

定义

用阴影样式、前景色和背景色定义矩形画笔。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
继承

示例

下面的示例演示如何创建上图HatchBrush中显示的。The 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枚举中的任何值。 HatchStyleThe 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, Color) HatchBrush(HatchStyle, Color) 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, Color, Color) HatchBrush(HatchStyle, Color, 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 BackgroundColor BackgroundColor BackgroundColor

获取此 HatchBrush 对象绘制的阴影线条间空间的颜色。Gets the color of spaces between the hatch lines drawn by this HatchBrush object.

ForegroundColor ForegroundColor ForegroundColor ForegroundColor

获取此 HatchBrush 对象绘制的阴影线条的颜色。Gets the color of hatch lines drawn by this HatchBrush object.

HatchStyle HatchStyle HatchStyle HatchStyle

获取此 HatchBrush 对象的阴影样式。Gets the hatch style of this HatchBrush object.

方法

Clone() Clone() Clone() Clone()

创建此 HatchBrush 对象的一个精确副本。Creates an exact copy of this HatchBrush object.

CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type)

创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
Dispose() Dispose() Dispose() Dispose()

释放由此 Brush 对象使用的所有资源。Releases all resources used by this Brush object.

(Inherited from Brush)
Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

释放由 Brush 占用的非托管资源,还可以另外再释放托管资源。Releases the unmanaged resources used by the Brush and optionally releases the managed resources.

(Inherited from Brush)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetLifetimeService() GetLifetimeService() GetLifetimeService() GetLifetimeService()

检索控制此实例的生存期策略的当前生存期服务对象。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService()

获取生存期服务对象来控制此实例的生存期策略。Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean)

创建当前 MarshalByRefObject 对象的浅表副本。Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
SetNativeBrush(IntPtr) SetNativeBrush(IntPtr) SetNativeBrush(IntPtr) SetNativeBrush(IntPtr)

在派生类中,设置对 GDI+GDI+ 画笔对象的引用。In a derived class, sets a reference to a GDI+GDI+ brush object.

(Inherited from Brush)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

适用于