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)

创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。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 使用的非托管资源,并选择性地释放托管资源。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()

检索控制此实例的生存期策略的当前生存期服务对象。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()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

适用于