Matrix.Rotate Metoda

Definice

Použije otočení po směru hodinových ručiček zadaného úhlu o počátku na tento Matrix.

Přetížení

Rotate(Single)

Předsunuto k tomuto Matrix otočení po směru hodinových ručiček, kolem počátku a podle zadaného úhlu.

Rotate(Single, MatrixOrder)

Použije otočení hodnoty zadané v parametru angle po směru hodinových ručiček kolem počátku (souřadnice nuly x a y) pro tento Matrixparametr .

Rotate(Single)

Zdroj:
Matrix.cs
Zdroj:
Matrix.cs
Zdroj:
Matrix.cs

Předsunuto k tomuto Matrix otočení po směru hodinových ručiček, kolem počátku a podle zadaného úhlu.

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

Parametry

angle
Single

Úhel otáčení ve stupních.

Příklady

Příklad naleznete v tématu Rotate(Single, MatrixOrder).

Platí pro

Rotate(Single, MatrixOrder)

Zdroj:
Matrix.cs
Zdroj:
Matrix.cs
Zdroj:
Matrix.cs

Použije otočení hodnoty zadané v parametru angle po směru hodinových ručiček kolem počátku (souřadnice nuly x a y) pro tento Matrixparametr .

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)

Parametry

angle
Single

Úhel (rozsah) otáčení ve stupních.

order
MatrixOrder

A MatrixOrder , který určuje pořadí (doplňovací nebo předsazení), ve kterém se u tohoto Matrixobjektu použije rotace .

Příklady

Následující příklad kódu je navržený pro použití s model Windows Forms a vyžaduje PaintEventArgsePaint objekt události. Kód provede následující akce:

  • Nakreslí na obrazovku obdélník před použitím transformace otočení (modrý obdélník).

  • Vytvoří matici a otočí ji o 45 stupňů.

  • Použije tuto maticovou transformaci na obdélník.

  • Nakreslí transformovaný obdélník na obrazovku (červený obdélník).

Všimněte si, že červený obdélník byl otočen kolem souřadnic obrazovky 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

Platí pro