LinearGradientBrush.SetSigmaBellShape 方法

定义

创建基于钟形曲线的渐变过渡过程。

重载

SetSigmaBellShape(Single)

创建基于钟形曲线的渐变过渡过程。

SetSigmaBellShape(Single, Single)

创建基于钟形曲线的渐变过渡过程。

SetSigmaBellShape(Single)

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

创建基于钟形曲线的渐变过渡过程。

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

参数

focus
Single

介于 0 到 1 之间的一个值,它指定渐变中心(起始色和结束色均匀混合的点)。

示例

有关示例,请参阅 SetSigmaBellShape.

注解

此方法指定一个 focus,该点是渐变仅由结束颜色组成的点。 参数 focus 将位置表示为沿渐变线距离的比例。 渐变根据钟形曲线形状下降到起始颜色, (两侧) 正态分布。

适用于

SetSigmaBellShape(Single, Single)

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

创建基于钟形曲线的渐变过渡过程。

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)

参数

focus
Single

介于 0 到 1 之间的一个值,它指定渐变中心(只由结束色构成渐变的点)。

scale
Single

介于 0 到 1 之间的一个值,它指定颜色从 focus 过渡的过渡速度。

示例

下面的代码示例旨在与 Windows 窗体 一起使用,它需要 PaintEventArgse事件OnPaint对象。 此代码执行以下操作:

  • 创建一个新的 LinearGradientBrush

  • 使用此画笔将椭圆绘制到具有颜色线性从左到右过渡的屏幕。

  • 转换 , LinearGradientBrush 使其具有钟形曲线,其峰值位于中心。

  • 使用钟形画笔在屏幕上绘制第二个椭圆。

请注意,下椭圆的渐变从蓝色过渡到红色,然后转换回蓝色。

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

注解

此方法指定一个 focus,该点是渐变仅由结束颜色组成的点。 参数 focus 将位置表示为沿渐变线距离的比例。 渐变根据钟形曲线形状下降到起始颜色, (两侧) 正态分布。

适用于