แก้ไข

แชร์ผ่าน


LinearGradientBrush.SetSigmaBellShape Method

Definition

Creates a gradient falloff based on a bell-shaped curve.

Overloads

SetSigmaBellShape(Single)

Creates a gradient falloff based on a bell-shaped curve.

SetSigmaBellShape(Single, Single)

Creates a gradient falloff based on a bell-shaped curve.

SetSigmaBellShape(Single)

Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs

Creates a gradient falloff based on a bell-shaped curve.

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

Parameters

focus
Single

A value from 0 through 1 that specifies the center of the gradient (the point where the starting color and ending color are blended equally).

Examples

For an example, see SetSigmaBellShape.

Remarks

This method specifies a focus, which is the point where the gradient is composed only of the ending color. The focus parameter represents a location as a proportion of the distance along the gradient line. The gradient falls off to the starting color based on a bell curve shape (normal distribution) to either side.

Applies to

SetSigmaBellShape(Single, Single)

Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs

Creates a gradient falloff based on a bell-shaped curve.

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)

Parameters

focus
Single

A value from 0 through 1 that specifies the center of the gradient (the point where the gradient is composed of only the ending color).

scale
Single

A value from 0 through 1 that specifies how fast the colors falloff from the focus.

Examples

The following code example is designed for use with Windows Forms, and it requires PaintEventArgs e, an OnPaint event object. The code performs the following actions:

  • Creates a new LinearGradientBrush.

  • Uses this brush to draw an ellipse to the screen that has a linear, left-to-right transition of colors.

  • Transforms the LinearGradientBrush to have a bell shaped curve with its peak in the center.

  • Draws a second ellipse to the screen using the bell-shaped brush.

Notice that the gradient of the lower ellipse transitions from blue to red and then back to blue.

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

Remarks

This method specifies a focus, which is the point where the gradient is composed only of the ending color. The focus parameter represents a location as a proportion of the distance along the gradient line. The gradient falls off to the starting color based on a bell curve shape (normal distribution) to either side.

Applies to