# Blend 类

## 定义

``public ref class Blend sealed``
``public sealed class Blend``
``type Blend = class``
``Public NotInheritable Class Blend``

Blend

## 示例

``````public:
void BlendConstExample( PaintEventArgs^ e )
{
//Draw ellipse using Blend.
Point startPoint2 = Point(20,110);
Point endPoint2 = Point(140,110);
array<Single>^myFactors = {.2f,.4f,.8f,.8f,.4f,.2f};
array<Single>^myPositions = {0.0f,.2f,.4f,.6f,.8f,1.0f};
Blend^ myBlend = gcnew Blend;
myBlend->Factors = myFactors;
myBlend->Positions = myPositions;
gcnew LinearGradientBrush( startPoint2,endPoint2,Color::Blue,Color::Red );
lgBrush2->Blend = myBlend;
Rectangle ellipseRect2 = Rectangle(20,110,120,80);
e->Graphics->FillEllipse( lgBrush2, ellipseRect2 );

// End example.
}
``````
``````public void BlendConstExample(PaintEventArgs e)
{

//Draw ellipse using Blend.
Point startPoint2 = new Point(20, 110);
Point endPoint2 = new Point(140, 110);
float[] myFactors = {.2f,.4f,.8f,.8f,.4f,.2f};
float[] myPositions = {0.0f,.2f,.4f,.6f,.8f,1.0f};
Blend myBlend = new Blend();
myBlend.Factors = myFactors;
myBlend.Positions = myPositions;
startPoint2,
endPoint2,
Color.Blue,
Color.Red);
lgBrush2.Blend = myBlend;
Rectangle ellipseRect2 = new Rectangle(20, 110, 120, 80);
e.Graphics.FillEllipse(lgBrush2, ellipseRect2);

// End example.
}
``````
``````Public Sub BlendConstExample(ByVal e As PaintEventArgs)

' Draw ellipse using Blend.
Dim startPoint2 As New Point(20, 110)
Dim endPoint2 As New Point(140, 110)
Dim myFactors As Single() = {0.2F, 0.4F, 0.8F, 0.8F, 0.4F, 0.2F}
Dim myPositions As Single() = {0.0F, 0.2F, 0.4F, 0.6F, 0.8F, 1.0F}
Dim myBlend As New Blend
myBlend.Factors = myFactors
myBlend.Positions = myPositions
Dim lgBrush2 As New LinearGradientBrush(startPoint2, endPoint2, _
Color.Blue, Color.Red)
lgBrush2.Blend = myBlend
Dim ellipseRect2 As New Rectangle(20, 110, 120, 80)
e.Graphics.FillEllipse(lgBrush2, ellipseRect2)
End Sub
``````

## 构造函数

 初始化 Blend 类的新实例。Initializes a new instance of the Blend class. 用指定的因子和位置的数目初始化 Blend 类的新实例。Initializes a new instance of the Blend class with the specified number of factors and positions.

## 属性

 获取或设置用于渐变的混合因子数组。Gets or sets an array of blend factors for the gradient. 获取或设置渐变的混合位置的数组。Gets or sets an array of blend positions for the gradient.

## 方法

 确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object. (继承自 Object) 用作默认哈希函数。Serves as the default hash function. (继承自 Object) 获取当前实例的 Type。Gets the Type of the current instance. (继承自 Object) 创建当前 Object 的浅表副本。Creates a shallow copy of the current Object. (继承自 Object) 返回一个表示当前对象的 string。Returns a string that represents the current object. (继承自 Object)