PathGradientBrush.SetSigmaBellShape Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Cria uma queda de gradiente entre a cor central e a primeira cor envolvente com base numa curva em forma de sino.
Sobrecargas
| Name | Description |
|---|---|
| SetSigmaBellShape(Single) |
Cria um pincel de gradiente que muda de cor a partir do centro do caminho para fora até ao limite do caminho. A transição de uma cor para outra baseia-se numa curva em forma de sino. |
| SetSigmaBellShape(Single, Single) |
Cria um pincel de gradiente que muda de cor a partir do centro do caminho para fora até ao limite do caminho. A transição de uma cor para outra baseia-se numa curva em forma de sino. |
SetSigmaBellShape(Single)
Cria um pincel de gradiente que muda de cor a partir do centro do caminho para fora até ao limite do caminho. A transição de uma cor para outra baseia-se numa curva em forma de sino.
public:
void SetSigmaBellShape(float focus);
public void SetSigmaBellShape(float focus);
member this.SetSigmaBellShape : single -> unit
Public Sub SetSigmaBellShape (focus As Single)
Parâmetros
- focus
- Single
Um valor de 0 a 1 que especifica onde, ao longo de qualquer radial desde o centro do caminho até ao limite do caminho, a cor central estará na sua intensidade máxima. Um valor de 1 (o padrão) coloca a maior intensidade no centro do caminho.
Exemplos
Para obter um exemplo, consulte SetSigmaBellShape.
Observações
Se houver mais do que uma cor no SurroundColors array, a primeira cor do array é usada para a cor final. As cores especificadas neste arranjo são cores usadas para pontos discretos no percurso da fronteira do pincel.
Por defeito, à medida que se move do limite de um gradiente de caminho para o ponto central, a cor muda gradualmente da cor da fronteira para a cor central. Pode personalizar a posição e a mistura das cores do limite e do centro chamando este método.
Aplica-se a
SetSigmaBellShape(Single, Single)
Cria um pincel de gradiente que muda de cor a partir do centro do caminho para fora até ao limite do caminho. A transição de uma cor para outra baseia-se numa curva em forma de sino.
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)
Parâmetros
- focus
- Single
Um valor de 0 a 1 que especifica onde, ao longo de qualquer radial desde o centro do caminho até ao limite do caminho, a cor central estará na sua intensidade máxima. Um valor de 1 (o padrão) coloca a maior intensidade no centro do caminho.
- scale
- Single
Um valor de 0 a 1 que especifica a intensidade máxima da cor central que se mistura com a cor da fronteira. Um valor de 1 causa a maior intensidade possível da cor central, sendo este o valor padrão.
Exemplos
O seguinte exemplo de código foi concebido para uso com Windows Forms e requer PaintEventArgse, um objeto de evento OnPaint. O código executa as seguintes ações:
Cria um caminho gráfico e adiciona um retângulo a ele.
Cria um PathGradientBrush a partir dos pontos do caminho (neste exemplo, os pontos formam um retângulo, mas pode ser quase qualquer forma).
Define a cor central para vermelho e a cor circundante para azul.
Desenha-o PathGradientBrush para o ecrã antes de aplicar a transformação de fusão.
Aplica a transformação de mistura ao pincel usando o seu SetSigmaBellShape método.
Chama o TranslateTransform método para mover o retângulo do pincel de modo a não sobrepor o que foi desenhado anteriormente no ecrã.
Desenha o retângulo do pincel transformado para o ecrã.
Note que a cor máxima do centro (vermelho) está localizada a meio caminho entre o centro do percurso e o limite do percurso.
public:
void SetSigmaBellShapeExample( PaintEventArgs^ e )
{
// Create a graphics path and add a rectangle.
GraphicsPath^ myPath = gcnew GraphicsPath;
Rectangle rect = Rectangle(100,20,100,50);
myPath->AddRectangle( rect );
// Get the path's array of points.
array<PointF>^myPathPointArray = myPath->PathPoints;
// Create a path gradient brush.
PathGradientBrush^ myPGBrush = gcnew PathGradientBrush( myPathPointArray );
// Set the color span.
myPGBrush->CenterColor = Color::Red;
array<Color>^ mySurroundColor = {Color::Blue};
myPGBrush->SurroundColors = mySurroundColor;
// Draw the brush to the screen prior to blend.
e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 200 );
// Set the Blend factors and transform the brush.
myPGBrush->SetSigmaBellShape( 0.5f, 1.0f );
// Move the brush down by 100 by applying the translate
// transform to the brush.
myPGBrush->TranslateTransform( 0, 100, MatrixOrder::Append );
// Draw the brush to the screen again after setting the
// blend and applying the transform.
e->Graphics->FillRectangle( myPGBrush, 10, 10, 300, 300 );
}
public void SetSigmaBellShapeExample(PaintEventArgs e)
{
// Create a graphics path and add a rectangle.
GraphicsPath myPath = new GraphicsPath();
Rectangle rect = new Rectangle(100, 20, 100, 50);
myPath.AddRectangle(rect);
// Get the path's array of points.
PointF[] myPathPointArray = myPath.PathPoints;
// Create a path gradient brush.
PathGradientBrush myPGBrush = new
PathGradientBrush(myPathPointArray);
// Set the color span.
myPGBrush.CenterColor = Color.Red;
Color[] mySurroundColor = {Color.Blue};
myPGBrush.SurroundColors = mySurroundColor;
// Draw the brush to the screen prior to blend.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200);
// Set the Blend factors and transform the brush.
myPGBrush.SetSigmaBellShape(0.5f, 1.0f);
// Move the brush down by 100 by applying the translate
// transform to the brush.
myPGBrush.TranslateTransform(0, 100, MatrixOrder.Append);
// Draw the brush to the screen again after setting the
// blend and applying the transform.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 300, 300);
}
Public Sub SetSigmaBellShapeExample(ByVal e As PaintEventArgs)
' Create a graphics path and add a rectangle.
Dim myPath As New GraphicsPath
Dim rect As New Rectangle(100, 20, 100, 50)
myPath.AddRectangle(rect)
' Get the path's array of points.
Dim myPathPointArray As PointF() = myPath.PathPoints
' Create a path gradient brush.
Dim myPGBrush As New PathGradientBrush(myPathPointArray)
' Set the color span.
myPGBrush.CenterColor = Color.Red
Dim mySurroundColor As Color() = {Color.Blue}
myPGBrush.SurroundColors = mySurroundColor
' Draw the brush to the screen prior to blend.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200)
' Set the Blend factors.
myPGBrush.SetSigmaBellShape(0.5F, 1.0F)
' Move the brush down by 100 by applying the translate
' transform to the brush.
myPGBrush.TranslateTransform(0, 100, MatrixOrder.Append)
' Draw the brush to the screen again after setting the
' blend and applying the transform.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 300, 300)
End Sub
Observações
Se houver mais do que uma cor no SurroundColors array, a primeira cor do array é usada para a cor final. As cores especificadas neste arranjo são cores usadas para pontos discretos no percurso da fronteira do pincel.
Por defeito, à medida que se move do limite de um gradiente de caminho para o ponto central, a cor muda gradualmente da cor da fronteira para a cor central. Pode personalizar a posição e a mistura das cores do limite e do centro chamando este método.