Matrix.Scale Método

Definición

Aplica el vector de escala especificado a esta Matrix anteponiendo el vector de escala.

Sobrecargas

Scale(Single, Single)

Aplica el vector de escala especificado a esta Matrix anteponiendo el vector de escala.

Scale(Single, Single, MatrixOrder)

Aplica el vector de escala especificado (scaleX y scaleY) a esta Matrix en el orden especificado.

Scale(Single, Single)

Source:
Matrix.cs
Source:
Matrix.cs
Source:
Matrix.cs

Aplica el vector de escala especificado a esta Matrix anteponiendo el vector de escala.

public:
 void Scale(float scaleX, float scaleY);
public void Scale (float scaleX, float scaleY);
member this.Scale : single * single -> unit
Public Sub Scale (scaleX As Single, scaleY As Single)

Parámetros

scaleX
Single

Valor por el que se va a ajustar el tamaño de Matrix en la dirección del eje X.

scaleY
Single

Valor por el que se va a ajustar el tamaño de Matrix en la dirección del eje Y.

Ejemplos

Para obtener un ejemplo, consulte Scale(Single, Single, MatrixOrder).

Se aplica a

Scale(Single, Single, MatrixOrder)

Source:
Matrix.cs
Source:
Matrix.cs
Source:
Matrix.cs

Aplica el vector de escala especificado (scaleX y scaleY) a esta Matrix en el orden especificado.

public:
 void Scale(float scaleX, float scaleY, System::Drawing::Drawing2D::MatrixOrder order);
public void Scale (float scaleX, float scaleY, System.Drawing.Drawing2D.MatrixOrder order);
member this.Scale : single * single * System.Drawing.Drawing2D.MatrixOrder -> unit
Public Sub Scale (scaleX As Single, scaleY As Single, order As MatrixOrder)

Parámetros

scaleX
Single

Valor por el que se va a ajustar el tamaño de Matrix en la dirección del eje X.

scaleY
Single

Valor por el que se va a ajustar el tamaño de Matrix en la dirección del eje Y.

order
MatrixOrder

MatrixOrder que especifica el orden (agregar o anteponer) en que se aplica el vector de escala a esta Matrix.

Ejemplos

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

  • Dibuja un rectángulo en la pantalla antes de aplicar una transformación de escalado (el rectángulo azul).

  • Crea una matriz y la escala en 3 en el eje x y 2 en el eje Y.

  • Aplica esta transformación de matriz al rectángulo.

  • Dibuja el rectángulo transformado en la pantalla (el rectángulo rojo).

Observe que el rectángulo rojo se ha escalado mediante un factor de 3 en el eje x y en 2 en el eje y, incluida la esquina superior izquierda del rectángulo (el punto inicial del rectángulo).

public:
   void ScaleExample( PaintEventArgs^ e )
   {
      Pen^ myPen = gcnew Pen( Color::Blue,1.0f );
      Pen^ myPen2 = gcnew Pen( Color::Red,1.0f );

      // Draw the rectangle to the screen before applying the
      // transform.
      e->Graphics->DrawRectangle( myPen, 50, 50, 100, 100 );

      // Create a matrix and scale it.
      Matrix^ myMatrix = gcnew Matrix;
      myMatrix->Scale( 3, 2, MatrixOrder::Append );

      // Draw the rectangle to the screen again after applying the
      // transform.
      e->Graphics->Transform = myMatrix;
      e->Graphics->DrawRectangle( myPen2, 50, 50, 100, 100 );
   }
public void ScaleExample(PaintEventArgs e)
{
    Pen myPen = new Pen(Color.Blue, 1);
    Pen myPen2 = new Pen(Color.Red, 1);
             
    // Draw the rectangle to the screen before applying the
    // transform.
    e.Graphics.DrawRectangle(myPen, 50, 50, 100, 100);
             
    // Create a matrix and scale it.
    Matrix myMatrix = new Matrix();
    myMatrix.Scale(3, 2, MatrixOrder.Append);
             
    // Draw the rectangle to the screen again after applying the
    // transform.
    e.Graphics.Transform = myMatrix;
    e.Graphics.DrawRectangle(myPen2, 50, 50, 100, 100);
}
Public Sub ScaleExample(ByVal e As PaintEventArgs)
    Dim myPen As New Pen(Color.Blue, 1)
    Dim myPen2 As New Pen(Color.Red, 1)

    ' Draw the rectangle to the screen before applying the
    ' transform.
    e.Graphics.DrawRectangle(myPen, 50, 50, 100, 100)

    ' Create a matrix and scale it.
    Dim myMatrix As New Matrix
    myMatrix.Scale(3, 2, MatrixOrder.Append)

    ' Draw the rectangle to the screen again after applying the
    ' transform.
    e.Graphics.Transform = myMatrix
    e.Graphics.DrawRectangle(myPen2, 50, 50, 100, 100)
End Sub

Se aplica a