ColorBlend コンストラクター

定義

ColorBlend クラスの新しいインスタンスを初期化します。

オーバーロード

ColorBlend()

ColorBlend クラスの新しいインスタンスを初期化します。

ColorBlend(Int32)

指定した色の数と位置の数を使用して、ColorBlend クラスの新しいインスタンスを初期化します。

ColorBlend()

ソース:
ColorBlend.cs
ソース:
ColorBlend.cs
ソース:
ColorBlend.cs

ColorBlend クラスの新しいインスタンスを初期化します。

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

次の例は、Windows フォーム環境で使用することを目的としています。 クラスを クラスとLinearGradientBrush組み合わせて使用ColorBlendして、色がブレンドされた画面に楕円を描画する方法を示します。 楕円は左側が緑色で、黄色、青、最後に右側が赤にブレンドされます。 これは、 プロパティと プロパティでmyColors使用される 配列と myPositions 配列の設定をColorsPositions使用して実現されます。 InterpolationColorsという名前lgBrush2のオブジェクトの プロパティはLinearGradientBrush、 オブジェクト と等しくColorBlendする必要があることに注意してくださいmyBlend

protected:
   virtual void OnPaint( PaintEventArgs^ e ) override
   {
      //Draw ellipse using ColorBlend.
      Point startPoint2 = Point(20,110);
      Point endPoint2 = Point(140,110);
      array<Color>^ myColors =
            {Color::Green,Color::Yellow,Color::Yellow,Color::Blue,Color::Red,Color::Red};
      array<Single>^myPositions = {0.0f,.20f,.40f,.60f,.80f,1.0f};
      ColorBlend^ myBlend = gcnew ColorBlend;
      myBlend->Colors = myColors;
      myBlend->Positions = myPositions;
      LinearGradientBrush^ lgBrush2 =
            gcnew LinearGradientBrush( startPoint2,endPoint2,Color::Green,Color::Red );
      lgBrush2->InterpolationColors = myBlend;
      Rectangle ellipseRect2 = Rectangle(20,110,120,80);
      e->Graphics->FillEllipse( lgBrush2, ellipseRect2 );
   }
protected override void OnPaint(PaintEventArgs e)
{
             
    //Draw ellipse using ColorBlend.
    Point startPoint2 = new Point(20, 110);
    Point endPoint2 = new Point(140, 110);
    Color[] myColors = {Color.Green,
                           Color.Yellow,
                           Color.Yellow,
                           Color.Blue,
                           Color.Red,
                           Color.Red};
    float[] myPositions = {0.0f,.20f,.40f,.60f,.80f,1.0f};
    ColorBlend myBlend = new ColorBlend();
    myBlend.Colors = myColors;
    myBlend.Positions = myPositions;
    LinearGradientBrush lgBrush2 = new LinearGradientBrush(startPoint2,
        endPoint2,
        Color.Green,
        Color.Red);
    lgBrush2.InterpolationColors = myBlend;
    Rectangle ellipseRect2 = new Rectangle(20, 110, 120, 80);
    e.Graphics.FillEllipse(lgBrush2, ellipseRect2);
}
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
    ' Draw ellipse using ColorBlend.
    Dim startPoint2 As New Point(20, 110)
    Dim endPoint2 As New Point(140, 110)
    Dim myColors As Color() = {Color.Green, Color.Yellow, _
    Color.Yellow, Color.Blue, Color.Red, Color.Red}
    Dim myPositions As Single() = {0.0F, 0.2F, 0.4F, 0.6F, 0.8F, 1.0F}
    Dim myBlend As New ColorBlend
    myBlend.Colors = myColors
    myBlend.Positions = myPositions
    Dim lgBrush2 As New LinearGradientBrush(startPoint2, endPoint2, _
    Color.Green, Color.Red)
    lgBrush2.InterpolationColors = myBlend
    Dim ellipseRect2 As New Rectangle(20, 110, 120, 80)
    e.Graphics.FillEllipse(lgBrush2, ellipseRect2)
End Sub

適用対象

ColorBlend(Int32)

ソース:
ColorBlend.cs
ソース:
ColorBlend.cs
ソース:
ColorBlend.cs

指定した色の数と位置の数を使用して、ColorBlend クラスの新しいインスタンスを初期化します。

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

パラメーター

count
Int32

この ColorBlend 内の色と位置の数。

例については、次を参照してください。 ColorBlend

適用対象