LinearGradientBrush.ScaleTransform Método
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Coloca a transformação geométrica local em escala pelos valores especificados. Esse método acrescenta a matriz de colocação em escala ao começo da transformação.
Sobrecargas
ScaleTransform(Single, Single) |
Coloca a transformação geométrica local em escala pelos valores especificados. Esse método acrescenta a matriz de colocação em escala ao começo da transformação. |
ScaleTransform(Single, Single, MatrixOrder) |
Escalas a transformação geométrica local pelos valores especificados na ordem especificada. |
ScaleTransform(Single, Single)
- Origem:
- LinearGradientBrush.cs
- Origem:
- LinearGradientBrush.cs
- Origem:
- LinearGradientBrush.cs
Coloca a transformação geométrica local em escala pelos valores especificados. Esse método acrescenta a matriz de colocação em escala ao começo da transformação.
public:
void ScaleTransform(float sx, float sy);
public void ScaleTransform (float sx, float sy);
member this.ScaleTransform : single * single -> unit
Public Sub ScaleTransform (sx As Single, sy As Single)
Parâmetros
- sx
- Single
O valor pelo qual colocar a transformação em escala na direção do eixo x.
- sy
- Single
O valor pelo qual colocar em escala a transformação na direção do eixo y.
Exemplos
Para ver um exemplo, consulte ScaleTransform.
Aplica-se a
ScaleTransform(Single, Single, MatrixOrder)
- Origem:
- LinearGradientBrush.cs
- Origem:
- LinearGradientBrush.cs
- Origem:
- LinearGradientBrush.cs
Escalas a transformação geométrica local pelos valores especificados na ordem especificada.
public:
void ScaleTransform(float sx, float sy, System::Drawing::Drawing2D::MatrixOrder order);
public void ScaleTransform (float sx, float sy, System.Drawing.Drawing2D.MatrixOrder order);
member this.ScaleTransform : single * single * System.Drawing.Drawing2D.MatrixOrder -> unit
Public Sub ScaleTransform (sx As Single, sy As Single, order As MatrixOrder)
Parâmetros
- sx
- Single
O valor pelo qual colocar a transformação em escala na direção do eixo x.
- sy
- Single
O valor pelo qual colocar em escala a transformação na direção do eixo y.
- order
- MatrixOrder
Um MatrixOrder que especifica se o acréscimo à matriz de colocação em escala deve ser no início ou no fim.
Exemplos
O exemplo de código a seguir foi projetado para uso com Windows Forms e requer PaintEventArgse
, um OnPaint objeto de evento. O código executa as seguintes ações:
Cria um novo LinearGradientBrush.
Desenhe uma elipse para a tela usando esse pincel.
Dimensiona o LinearGradientBrush por um fator de dois no eixo x.
Desenha uma elipse na tela diretamente abaixo da primeira elipse, usando o pincel dimensionado.
Observe que o gradiente da elipse inferior é estendido por um fator de dois. Observe também que uma chamada para o TranslateTransform método é usada para justificar a borda esquerda do preenchimento de gradiente com a borda esquerda da elipse.
private:
void ScaleTransformExample( 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 );
// Scale the LinearGradientBrush.
myLGBrush->ScaleTransform( 2.0f, 1.0f, MatrixOrder::Prepend );
// Rejustify the brush to start at the left edge of the ellipse.
myLGBrush->TranslateTransform( -20.0f, 0.0f );
// Draw a second ellipse to the screen using
// the transformed brush.
e->Graphics->FillEllipse( myLGBrush, 20, 150, 200, 100 );
}
private void ScaleTransformExample(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);
// Scale the LinearGradientBrush.
myLGBrush.ScaleTransform(2.0f, 1.0f, MatrixOrder.Prepend);
// Rejustify the brush to start at the left edge of the ellipse.
myLGBrush.TranslateTransform(-20.0f, 0.0f);
// Draw a second ellipse to the screen using
// the transformed brush.
e.Graphics.FillEllipse(myLGBrush, 20, 150, 200, 100);
}
Public Sub ScaleTransformExample(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)
' Scale the LinearGradientBrush.
myLGBrush.ScaleTransform(2.0F, 1.0F, MatrixOrder.Prepend)
' Rejustify the brush to start at the left edge of the ellipse.
myLGBrush.TranslateTransform(-20.0F, 0.0F)
' Draw a second ellipse to the screen using the transformed brush.
e.Graphics.FillEllipse(myLGBrush, 20, 150, 200, 100)
End Sub
Aplica-se a
Comentários
https://aka.ms/ContentUserFeedback.
Em breve: Ao longo de 2024, eliminaremos os problemas do GitHub como o mecanismo de comentários para conteúdo e o substituiremos por um novo sistema de comentários. Para obter mais informações, consulteEnviar e exibir comentários de