ColorBlend Konstruktorer

Definition

Initierar en ny instans av ColorBlend klassen.

Överlagringar

Name Description
ColorBlend()

Initierar en ny instans av ColorBlend klassen.

ColorBlend(Int32)

Initierar en ny instans av ColorBlend klassen med det angivna antalet färger och positioner.

ColorBlend()

Källa:
ColorBlend.cs
Källa:
ColorBlend.cs
Källa:
ColorBlend.cs
Källa:
ColorBlend.cs
Källa:
ColorBlend.cs
Källa:
ColorBlend.cs
Källa:
ColorBlend.cs
Källa:
ColorBlend.cs

Initierar en ny instans av ColorBlend klassen.

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

Exempel

Följande exempel är avsett att användas i en Windows Forms miljö. Den visar hur du använder ColorBlend klassen tillsammans med LinearGradientBrush klassen för att rita en ellips till skärm som har sina färger blandade. Ellipsen är grön till vänster, smälter till gult, sedan till blått och slutligen till rött till höger. Detta görs genom inställningarna i matriserna myColors och myPositions som används i Colors egenskaperna och Positions . Observera att egenskapen för InterpolationColors det namngivna LinearGradientBrushlgBrush2 objektet måste vara lika med ColorBlend objektet 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

Gäller för

ColorBlend(Int32)

Källa:
ColorBlend.cs
Källa:
ColorBlend.cs
Källa:
ColorBlend.cs
Källa:
ColorBlend.cs
Källa:
ColorBlend.cs
Källa:
ColorBlend.cs
Källa:
ColorBlend.cs
Källa:
ColorBlend.cs

Initierar en ny instans av ColorBlend klassen med det angivna antalet färger och positioner.

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

Parametrar

count
Int32

Antalet färger och positioner i den här ColorBlend.

Exempel

Ett exempel finns i ColorBlend

Gäller för