LinearGradientBrush.SetSigmaBellShape Metoda

Definicja

Tworzy spadek gradientu na podstawie krzywej w kształcie dzwonu.

Przeciążenia

SetSigmaBellShape(Single)

Tworzy spadek gradientu na podstawie krzywej w kształcie dzwonu.

SetSigmaBellShape(Single, Single)

Tworzy spadek gradientu na podstawie krzywej w kształcie dzwonu.

SetSigmaBellShape(Single)

Źródło:
LinearGradientBrush.cs
Źródło:
LinearGradientBrush.cs
Źródło:
LinearGradientBrush.cs

Tworzy spadek gradientu na podstawie krzywej w kształcie dzwonu.

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

Parametry

focus
Single

Wartość z zakresu od 0 do 1, która określa środek gradientu (punkt, w którym kolor początkowy i kolor końcowy są łączone równomiernie).

Przykłady

Aby zapoznać się z przykładem, zobacz SetSigmaBellShape.

Uwagi

Ta metoda określa focus, czyli punkt, w którym gradient składa się tylko z koloru końcowego. Parametr focus reprezentuje lokalizację jako proporcję odległości wzdłuż linii gradientu. Gradient spada do koloru początkowego na podstawie kształtu krzywej dzwonu (rozkład normalny) do obu stron.

Dotyczy

SetSigmaBellShape(Single, Single)

Źródło:
LinearGradientBrush.cs
Źródło:
LinearGradientBrush.cs
Źródło:
LinearGradientBrush.cs

Tworzy spadek gradientu na podstawie krzywej w kształcie dzwonu.

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)

Parametry

focus
Single

Wartość z zakresu od 0 do 1, która określa środek gradientu (punkt, w którym gradient składa się tylko z koloru końcowego).

scale
Single

Wartość z zakresu od 0 do 1, która określa, jak szybko kolory spadają z .focus

Przykłady

Poniższy przykład kodu jest przeznaczony do użytku z Windows Forms i wymaga PaintEventArgseobiektu OnPaint zdarzenia . Kod wykonuje następujące akcje:

  • Tworzy nowy adres LinearGradientBrush.

  • Używa tego pędzla do rysowania wielokropka na ekranie, który ma liniowe, od lewej do prawej przejścia kolorów.

  • Przekształca element, LinearGradientBrush aby mieć krzywą w kształcie dzwonu ze szczytem w środku.

  • Rysuje drugi wielokropek na ekranie za pomocą pędzla w kształcie dzwonu.

Zwróć uwagę, że gradient dolnej wielokropka przechodzi z niebieskiego na czerwony, a następnie z powrotem na niebieski.

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

Uwagi

Ta metoda określa focus, czyli punkt, w którym gradient składa się tylko z koloru końcowego. Parametr focus reprezentuje lokalizację jako proporcję odległości wzdłuż linii gradientu. Gradient spada do koloru początkowego na podstawie kształtu krzywej dzwonu (rozkład normalny) do obu stron.

Dotyczy