LinearGradientBrush.SetSigmaBellShape 方法
定义
创建基于钟形曲线的渐变过渡过程。Creates a gradient falloff based on a bell-shaped curve.
重载
| 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)
创建基于钟形曲线的渐变过渡过程。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)
参数
- focus
- Single
介于 0 到 1 之间的一个值,它指定渐变中心(起始色和结束色均匀混合的点)。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).
示例
有关示例,请参阅 SetSigmaBellShape.For an example, see SetSigmaBellShape.
注解
此方法指定一个 focus ,即渐变只由结束颜色组成的点。This method specifies a focus, which is the point where the gradient is composed only of the ending color. focus参数表示一个位置,该位置的比例为沿渐变线的距离。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.
适用于
SetSigmaBellShape(Single, Single)
创建基于钟形曲线的渐变过渡过程。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)
参数
- focus
- Single
介于 0 到 1 之间的一个值,它指定渐变中心(只由结束色构成渐变的点)。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
介于 0 到 1 之间的一个值,它指定颜色从 focus 过渡的过渡速度。A value from 0 through 1 that specifies how fast the colors falloff from the focus.
示例
下面的代码示例旨在与 Windows 窗体一起使用,并且它需要 PaintEventArgs e 一个 OnPaint 事件对象。The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, an OnPaint event object. 此代码执行以下操作:The code performs the following actions:
创建一个新的 LinearGradientBrush。Creates a new LinearGradientBrush.
使用此画笔在屏幕上绘制具有从左向右的线性过渡的椭圆。Uses this brush to draw an ellipse to the screen that has a linear, left-to-right transition of colors.
转换 LinearGradientBrush 以在中心产生一个钟形曲线的曲线。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
注解
此方法指定一个 focus ,即渐变只由结束颜色组成的点。This method specifies a focus, which is the point where the gradient is composed only of the ending color. focus参数表示一个位置,该位置的比例为沿渐变线的距离。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.