PathGradientBrush.ScaleTransform Método

Definición

Cambia el tamaño de la transformación geométrica local en las cantidades especificadas. Este método antepone la matriz de escala a la transformación.

Sobrecargas

ScaleTransform(Single, Single)

Cambia el tamaño de la transformación geométrica local en las cantidades especificadas. Este método antepone la matriz de escala a la transformación.

ScaleTransform(Single, Single, MatrixOrder)

Cambia el tamaño de la transformación geométrica local en las cantidades y en el orden especificados.

ScaleTransform(Single, Single)

Source:
PathGradientBrush.cs
Source:
PathGradientBrush.cs
Source:
PathGradientBrush.cs

Cambia el tamaño de la transformación geométrica local en las cantidades especificadas. Este método antepone la matriz de escala a la transformación.

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

Factor de escala de la transformación en la dirección del eje x.

sy
Single

Factor de escala de la transformación en la dirección del eje y.

Ejemplos

Para obtener un ejemplo, consulte ScaleTransform.

Se aplica a

ScaleTransform(Single, Single, MatrixOrder)

Source:
PathGradientBrush.cs
Source:
PathGradientBrush.cs
Source:
PathGradientBrush.cs

Cambia el tamaño de la transformación geométrica local en las cantidades y en el orden especificados.

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

Factor de escala de la transformación en la dirección del eje x.

sy
Single

Factor de escala de la transformación en la dirección del eje y.

order
MatrixOrder

MatrixOrder que especifica si la matriz de transformación de escala se agrega delante o detrás.

Ejemplos

El ejemplo de código siguiente está diseñado para su uso con Windows Forms y requiere PaintEventArgse, un OnPaint objeto de evento. El código.

  • Crea una ruta de acceso de gráficos y le agrega un rectángulo.

  • Crea un a PathGradientBrush partir de los puntos de ruta de acceso (en este ejemplo, los puntos forman un rectángulo, pero podría ser la mayoría de las formas).

  • Establece el color central en rojo y el color circundante en azul.

  • Dibuja en PathGradientBrush la pantalla antes de aplicar la transformación de escala.

  • Aplica la transformación de escala al pincel mediante su ScaleTransform método .

  • Llama al TranslateTransform método para mover el rectángulo del pincel de forma que no superponga el que se dibuja en la pantalla anteriormente.

  • Dibuja el rectángulo de pincel traducido en la pantalla.

Tenga en cuenta que el rectángulo inferior es el doble de tiempo en el eje X que el que se dibuja antes de la traducción.

public:
   void ScaleTransformExample( 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 transformation.
      e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 200 );

      // Scale by a factor of 2 in the x-axis by applying the scale
      // transform to the brush.
      myPGBrush->ScaleTransform( 2, 1, MatrixOrder::Append );

      // Move the brush down by 100 by Applying the translate
      // transform to the brush.
      myPGBrush->TranslateTransform(  -100, 100, MatrixOrder::Append );

      // Draw the brush to the screen again after applying the
      // transforms.
      e->Graphics->FillRectangle( myPGBrush, 10, 10, 300, 300 );
   }
public void ScaleTransformExample(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 transformation.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200);
             
    // Scale by a factor of 2 in the x-axis by applying the scale
    // transform to the brush.
    myPGBrush.ScaleTransform(2, 1, MatrixOrder.Append);
             
    // Move the brush down by 100 by Applying the translate
    // transform to the brush.
    myPGBrush.TranslateTransform(-100, 100, MatrixOrder.Append);
             
    // Draw the brush to the screen again after applying the
    // transforms.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 300, 300);
}
Public Sub ScaleTransformExample(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 transformation.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200)

    ' Scale by a factor of 2 in the x-axis by applying the scale
    ' transform to the brush.
    myPGBrush.ScaleTransform(2, 1, MatrixOrder.Append)

    ' Move the brush down by 100 by Applying the translate
    ' transform to the brush.
    myPGBrush.TranslateTransform(-100, 100, MatrixOrder.Append)

    ' Draw the brush to the screen again after applying the
    ' transforms.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 300, 300)
End Sub

Se aplica a