Blend 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化 Blend 类的新实例。
重载
Blend() |
初始化 Blend 类的新实例。 |
Blend(Int32) |
用指定的因子和位置的数目初始化 Blend 类的新实例。 |
Blend()
- Source:
- Blend.cs
- Source:
- Blend.cs
- Source:
- Blend.cs
初始化 Blend 类的新实例。
public:
Blend();
public Blend ();
Public Sub New ()
示例
以下示例旨在用于Windows 窗体环境。 它演示了 Blend 如何将 类与 LinearGradientBrush 类结合使用,将椭圆绘制到混合了颜色的屏幕上。 椭圆在左侧为蓝色,在中心混合为红色,在右侧混合回蓝色。 这可以通过 和 属性中使用的 和 myPositions
数组中的PositionsFactors设置myFactors
来实现。 请注意,Blend名为 lgBrush2
的 LinearGradientBrush 对象的 属性必须与 对象 myBlend
相等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;
LinearGradientBrush^ lgBrush2 =
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;
LinearGradientBrush lgBrush2 = new LinearGradientBrush(
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