Bagikan melalui


LinearGradientBrush.SetSigmaBellShape Metode

Definisi

Membuat falloff gradien berdasarkan kurva berbentuk bel.

Overload

SetSigmaBellShape(Single)

Membuat falloff gradien berdasarkan kurva berbentuk bel.

SetSigmaBellShape(Single, Single)

Membuat falloff gradien berdasarkan kurva berbentuk bel.

SetSigmaBellShape(Single)

Sumber:
LinearGradientBrush.cs
Sumber:
LinearGradientBrush.cs
Sumber:
LinearGradientBrush.cs
Sumber:
LinearGradientBrush.cs
Sumber:
LinearGradientBrush.cs

Membuat falloff gradien berdasarkan kurva berbentuk bel.

public:
 void SetSigmaBellShape(float focus);
public void SetSigmaBellShape (float focus);
member this.SetSigmaBellShape : single -> unit
Public Sub SetSigmaBellShape (focus As Single)

Parameter

focus
Single

Nilai dari 0 hingga 1 yang menentukan pusat gradien (titik di mana warna awal dan warna akhir dipadukan secara merata).

Contoh

Misalnya, lihat SetSigmaBellShape.

Keterangan

Metode ini menentukan focus, yang merupakan titik di mana gradien hanya terdiri dari warna akhir. Parameter focus mewakili lokasi sebagai proporsi jarak di sepanjang garis gradien. Gradien jatuh ke warna awal berdasarkan bentuk kurva bel (distribusi normal) ke salah satu sisi.

Berlaku untuk

SetSigmaBellShape(Single, Single)

Sumber:
LinearGradientBrush.cs
Sumber:
LinearGradientBrush.cs
Sumber:
LinearGradientBrush.cs
Sumber:
LinearGradientBrush.cs
Sumber:
LinearGradientBrush.cs

Membuat falloff gradien berdasarkan kurva berbentuk bel.

public:
 void SetSigmaBellShape(float focus, float scale);
public void SetSigmaBellShape (float focus, float scale);
member this.SetSigmaBellShape : single * single -> unit
Public Sub SetSigmaBellShape (focus As Single, scale As Single)

Parameter

focus
Single

Nilai dari 0 hingga 1 yang menentukan pusat gradien (titik di mana gradien hanya terdiri dari warna akhir).

scale
Single

Nilai dari 0 hingga 1 yang menentukan seberapa cepat warna jatuh dari focus.

Contoh

Contoh kode berikut dirancang untuk digunakan dengan Windows Forms, dan memerlukan PaintEventArgse, objek peristiwa OnPaint. Kode melakukan tindakan berikut:

  • Membuat LinearGradientBrushbaru.

  • Menggunakan kuas ini untuk menggambar elips ke layar yang memiliki transisi warna linier ke kanan.

  • Mengubah LinearGradientBrush untuk memiliki kurva berbentuk lonceng dengan puncaknya di tengah.

  • Menggambar elips kedua ke layar menggunakan kuas berbentuk bel.

Perhatikan bahwa gradien transisi elips bawah dari biru ke merah dan kemudian kembali ke biru.

private:
   void SetSigmaBellShapeExample( PaintEventArgs^ e )
   {
      // Create a LinearGradientBrush.
      Rectangle myRect = Rectangle(20,20,200,100);
      LinearGradientBrush^ myLGBrush = gcnew LinearGradientBrush( myRect,Color::Blue,Color::Red,0.0f,true );

      // Draw an ellipse to the screen using the LinearGradientBrush.
      e->Graphics->FillEllipse( myLGBrush, myRect );

      // Create a bell-shaped brush with the peak at the
      // center of the drawing area.
      myLGBrush->SetSigmaBellShape( .5f, 1.0f );

      // Use the bell- shaped brush to draw a second
      // ellipse.
      myRect.Y = 150;
      e->Graphics->FillEllipse( myLGBrush, myRect );
   }
private void SetSigmaBellShapeExample(PaintEventArgs e)
{
             
    // Create a LinearGradientBrush.
    Rectangle myRect = new Rectangle(20, 20, 200, 100);
    LinearGradientBrush myLGBrush = new LinearGradientBrush(
        myRect, Color.Blue, Color.Red,  0.0f, true);
             
    // Draw an ellipse to the screen using the LinearGradientBrush.
    e.Graphics.FillEllipse(myLGBrush, myRect);
             
    // Create a bell-shaped brush with the peak at the
             
    // center of the drawing area.
    myLGBrush.SetSigmaBellShape(.5f, 1.0f);
             
    // Use the bell- shaped brush to draw a second
    // ellipse.
    myRect.Y = 150;
    e.Graphics.FillEllipse(myLGBrush, myRect);
}
Public Sub SetSigmaBellShapeExample(ByVal e As PaintEventArgs)

    ' Create a LinearGradientBrush.
    Dim myRect As New Rectangle(20, 20, 200, 100)
    Dim myLGBrush As New LinearGradientBrush(myRect, Color.Blue, _
    Color.Red, 0.0F, True)

    ' Draw an ellipse to the screen using the LinearGradientBrush.
    e.Graphics.FillEllipse(myLGBrush, myRect)

    ' Create a triangular shaped brush with the peak at the center
    ' of the drawing area.
    myLGBrush.SetSigmaBellShape(0.5F, 1.0F)

    ' Use the triangular brush to draw a second ellipse.
    myRect.Y = 150
    e.Graphics.FillEllipse(myLGBrush, myRect)
End Sub

Keterangan

Metode ini menentukan focus, yang merupakan titik di mana gradien hanya terdiri dari warna akhir. Parameter focus mewakili lokasi sebagai proporsi jarak di sepanjang garis gradien. Gradien jatuh ke warna awal berdasarkan bentuk kurva bel (distribusi normal) ke salah satu sisi.

Berlaku untuk