LinearGradientBrush.SetSigmaBellShape 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
根據鐘型曲線來建立漸層減少。
多載
SetSigmaBellShape(Single) |
根據鐘型曲線來建立漸層減少。 |
SetSigmaBellShape(Single, Single) |
根據鐘型曲線來建立漸層減少。 |
SetSigmaBellShape(Single)
根據鐘型曲線來建立漸層減少。
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)
根據鐘型曲線來建立漸層減少。
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
指定色彩多快從 focus
減少的從 0 到 1 的值。
範例
下列程式代碼範例是設計來搭配 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
會將位置表示為沿著漸層線距離的比例。 漸層會根據鈴鐺曲線圖形 (正則分佈) 到任一側的開始色彩。
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應