語言

LinearGradientBrush.SetSigmaBellShape 方法

定義

根據鐘形曲線建立漸層下降。

多載

名稱 Description
SetSigmaBellShape(Single)

根據鐘形曲線建立漸層下降。

SetSigmaBellShape(Single, Single)

根據鐘形曲線建立漸層下降。

SetSigmaBellShape(Single)

來源:
LinearGradientBrush.cs
來源:
LinearGradientBrush.cs
來源:
LinearGradientBrush.cs
來源:
LinearGradientBrush.cs
來源:
LinearGradientBrush.cs
來源:
LinearGradientBrush.cs
來源:
LinearGradientBrush.cs
來源:
LinearGradientBrush.cs
來源:
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)

來源:
LinearGradientBrush.cs
來源:
LinearGradientBrush.cs
來源:
LinearGradientBrush.cs
來源:
LinearGradientBrush.cs
來源:
LinearGradientBrush.cs
來源:
LinearGradientBrush.cs
來源:
LinearGradientBrush.cs
來源:
LinearGradientBrush.cs
來源:
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 Forms 設計,並需要 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 以梯度線上距離的比例表示一個位置。 漸變會根據鐘形曲線(常態分布)向任一側遞減,回歸起始顏色。

適用於