Matrix.Scale Método

Definição

Aplica o vetor de escala especificado a este Matrix acrescentando o vetor de escala.

Sobrecargas

Scale(Single, Single)

Aplica o vetor de escala especificado a este Matrix acrescentando o vetor de escala.

Scale(Single, Single, MatrixOrder)

Aplica o vetor de escala especificado (scaleX e scaleY) a esta Matrix usando a ordem especificada.

Scale(Single, Single)

Origem:
Matrix.cs
Origem:
Matrix.cs
Origem:
Matrix.cs

Aplica o vetor de escala especificado a este Matrix acrescentando o vetor 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

O valor segundo o qual este Matrix deve ser dimensionado na direção do eixo x.

scaleY
Single

O valor segundo o qual este Matrix deve ser dimensionado na direção do eixo y.

Exemplos

Para ver um exemplo, consulte Scale(Single, Single, MatrixOrder).

Aplica-se a

Scale(Single, Single, MatrixOrder)

Origem:
Matrix.cs
Origem:
Matrix.cs
Origem:
Matrix.cs

Aplica o vetor de escala especificado (scaleX e scaleY) a esta Matrix usando a ordem especificada.

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

O valor segundo o qual este Matrix deve ser dimensionado na direção do eixo x.

scaleY
Single

O valor segundo o qual este Matrix deve ser dimensionado na direção do eixo y.

order
MatrixOrder

Um MatrixOrder que especifica a ordem (suceder ou preceder) em que o vetor de escala é aplicado a este Matrix.

Exemplos

O exemplo de código a seguir foi projetado para uso com Windows Forms e requer PaintEventArgse, um Paint objeto de evento. O código executa as seguintes ações:

  • Desenha um retângulo na tela antes de aplicar uma transformação de dimensionamento (o retângulo azul).

  • Cria uma matriz e a dimensiona em 3 no eixo x e 2 no eixo y.

  • Aplica essa transformação de matriz ao retângulo.

  • Desenha o retângulo transformado na tela (o retângulo vermelho).

Observe que o retângulo vermelho foi dimensionado por um fator de 3 no eixo x e por 2 no eixo y, incluindo o canto superior esquerdo do retângulo (o ponto inicial do retâ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

Aplica-se a