共用方式為


Blend 建構函式

定義

初始化 Blend 類別的新執行個體。

多載

Blend()

初始化 Blend 類別的新執行個體。

Blend(Int32)

使用指定數量的因數和位置,初始化 Blend 類別的新執行個體。

Blend()

來源:
Blend.cs
來源:
Blend.cs
來源:
Blend.cs

初始化 Blend 類別的新執行個體。

public:
 Blend();
public Blend ();
Public Sub New ()

範例

下列範例旨在用於 Windows Forms 環境中。 它示範如何使用 Blend 類別搭配 LinearGradientBrush 類別,繪製橢圓形到已混合色彩的螢幕。 省略號是左側的藍色、在中央混合為紅色,並向右混合回藍色。 這可透過和屬性中使用的和 myPositionsPositions 數位中的myFactorsFactors設定來完成。 請注意,Blend名為 lgBrush2 的物件屬性LinearGradientBrush必須等於 Blend 物件 myBlend

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

適用於

Blend(Int32)

來源:
Blend.cs
來源:
Blend.cs
來源:
Blend.cs

使用指定數量的因數和位置,初始化 Blend 類別的新執行個體。

public:
 Blend(int count);
public Blend (int count);
new System.Drawing.Drawing2D.Blend : int -> System.Drawing.Drawing2D.Blend
Public Sub New (count As Integer)

參數

count
Int32

FactorsPositions 陣列中的元素數目。

範例

如需範例,請參閱 Blend

適用於