Compartir vía


LinearGradientBrush.ScaleTransform Método

Definición

Escala la transformación geométrica local por las cantidades especificadas. Este método antepone la matriz de escalado a la transformación.

Sobrecargas

ScaleTransform(Single, Single)

Escala la transformación geométrica local por las cantidades especificadas. Este método antepone la matriz de escalado a la transformación.

ScaleTransform(Single, Single, MatrixOrder)

Escala la transformación geométrica local por las cantidades especificadas en el orden especificado.

ScaleTransform(Single, Single)

Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs

Escala la transformación geométrica local por las cantidades especificadas. Este método antepone la matriz de escalado 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

Cantidad por la que se va a escalar la transformación en la dirección del eje X.

sy
Single

Cantidad por la que se va a escalar la transformación en la dirección del eje Y.

Ejemplos

Para obtener un ejemplo, vea ScaleTransform.

Se aplica a

ScaleTransform(Single, Single, MatrixOrder)

Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs
Source:
LinearGradientBrush.cs

Escala la transformación geométrica local por las cantidades especificadas en el orden especificado.

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

Cantidad por la que se va a escalar la transformación en la dirección del eje X.

sy
Single

Cantidad por la que se va a escalar la transformación en la dirección del eje Y.

order
MatrixOrder

Un MatrixOrder que especifica si se va a anexar o anteponer la matriz de escalado.

Ejemplos

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

  • Crea un nuevo LinearGradientBrush.

  • Dibuje una elipse en la pantalla con este pincel.

  • Escala el LinearGradientBrush por un factor de dos en el eje X.

  • Dibuja una elipse en la pantalla directamente debajo de la primera elipse, utilizando el pincel escalado.

Observe que el degradado de la elipse inferior se extiende por un factor de dos. Observe también que se usa una llamada al método TranslateTransform para justificar el borde izquierdo del relleno degradado con el borde izquierdo de la 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

Se aplica a