Matrix.Rotate Método

Definición

Aplica a esta Matrix un giro del ángulo especificado y en el sentido de las agujas del reloj en torno al origen.

Sobrecargas

Rotate(Single)

Antepone a esta Matrix un giro en el sentido de las agujas del reloj, en torno al origen y del ángulo especificado.

Rotate(Single, MatrixOrder)

Aplica a esta angle un giro en el sentido de las agujas del reloj y en la cantidad especificada en el parámetro Matrix, en torno al origen (coordenadas x e y cero).

Rotate(Single)

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

Antepone a esta Matrix un giro en el sentido de las agujas del reloj, en torno al origen y del ángulo especificado.

public:
 void Rotate(float angle);
public void Rotate (float angle);
member this.Rotate : single -> unit
Public Sub Rotate (angle As Single)

Parámetros

angle
Single

Ángulo de rotación, en grados.

Ejemplos

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

Se aplica a

Rotate(Single, MatrixOrder)

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

Aplica a esta angle un giro en el sentido de las agujas del reloj y en la cantidad especificada en el parámetro Matrix, en torno al origen (coordenadas x e y cero).

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

Parámetros

angle
Single

Ángulo (alcance) de rotación, en grados.

order
MatrixOrder

Un MatrixOrder que especifica el orden (agregar o anteponer) en el que se aplica el giro 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 rotación (el rectángulo azul).

  • Crea una matriz y la gira 45 grados.

  • 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 girado alrededor de las coordenadas de pantalla 0, 0.

public:
   void RotateExample( 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, 150, 50, 200, 100 );

      // Create a matrix and rotate it 45 degrees.
      Matrix^ myMatrix = gcnew Matrix;
      myMatrix->Rotate( 45, MatrixOrder::Append );

      // Draw the rectangle to the screen again after applying the
      // transform.
      e->Graphics->Transform = myMatrix;
      e->Graphics->DrawRectangle( myPen2, 150, 50, 200, 100 );
   }
public void RotateExample(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, 150, 50, 200, 100);
             
    // Create a matrix and rotate it 45 degrees.
    Matrix myMatrix = new Matrix();
    myMatrix.Rotate(45, MatrixOrder.Append);
             
    // Draw the rectangle to the screen again after applying the
             
    // transform.
    e.Graphics.Transform = myMatrix;
    e.Graphics.DrawRectangle(myPen2, 150, 50, 200, 100);
}
Public Sub RotateExample(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, 150, 50, 200, 100)

    ' Create a matrix and rotate it 45 degrees.
    Dim myMatrix As New Matrix
    myMatrix.Rotate(45, MatrixOrder.Append)

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

Se aplica a