Sdílet prostřednictvím


Graphics.RotateTransform Metoda

Definice

Použije zadanou rotaci na transformační matici tohoto Graphics.

Přetížení

RotateTransform(Single)

Použije zadanou rotaci na transformační matici tohoto Graphics.

RotateTransform(Single, MatrixOrder)

Použije zadanou rotaci na matici transformace tohoto Graphics v zadaném pořadí.

RotateTransform(Single)

Zdroj:
Graphics.cs
Zdroj:
Graphics.cs
Zdroj:
Graphics.cs
Zdroj:
Graphics.cs
Zdroj:
Graphics.cs

Použije zadanou rotaci na transformační matici tohoto Graphics.

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

Parametry

angle
Single

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

Příklady

Následující příklad kódu je určený pro použití s Windows Forms a vyžaduje PaintEventArgse, což je parametr obslužné rutiny události Paint. Kód provede následující akce:

  • Přeloží světovou transformační matici formuláře Windows Form vektorem (100, 0).

  • Otočí světovou transformaci o úhel 30 stupňů a předsadí matici otočení na světovou transformační matici.

  • Nakreslí otočené, přeložené tři tečky modrým perem.

public:
   void RotateTransformAngle( PaintEventArgs^ e )
   {
      // Set world transform of graphics object to translate.
      e->Graphics->TranslateTransform( 100.0F, 0.0F );

      // Then to rotate, prepending rotation matrix.
      e->Graphics->RotateTransform( 30.0F );

      // Draw rotated, translated ellipse to screen.
      e->Graphics->DrawEllipse( gcnew Pen( Color::Blue,3.0f ), 0, 0, 200, 80 );
   }
private void RotateTransformAngle(PaintEventArgs e)
{

    // Set world transform of graphics object to translate.
    e.Graphics.TranslateTransform(100.0F, 0.0F);

    // Then to rotate, prepending rotation matrix.
    e.Graphics.RotateTransform(30.0F);

    // Draw rotated, translated ellipse to screen.
    e.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);
}
Private Sub RotateTransformAngle(ByVal e As PaintEventArgs)

    ' Set world transform of graphics object to translate.
    e.Graphics.TranslateTransform(100.0F, 0.0F)

    ' Then to rotate, prepending rotation matrix.
    e.Graphics.RotateTransform(30.0F)

    ' Draw rotated, translated ellipse to screen.
    e.Graphics.DrawEllipse(New Pen(Color.Blue, 3), 0, 0, 200, 80)
End Sub

Poznámky

Operace otáčení se skládá z vynásobení transformační matice maticí, jejíž prvky jsou odvozeny z parametru angle. Tato metoda použije otočení tak, že ho předzálohuje na matici transformace.

Platí pro

RotateTransform(Single, MatrixOrder)

Zdroj:
Graphics.cs
Zdroj:
Graphics.cs
Zdroj:
Graphics.cs
Zdroj:
Graphics.cs
Zdroj:
Graphics.cs

Použije zadanou rotaci na matici transformace tohoto Graphics v zadaném pořadí.

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

Parametry

angle
Single

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

order
MatrixOrder

Člen MatrixOrder výčtu, který určuje, zda je rotace připojena nebo předem připojena k maticové transformaci.

Příklady

Následující příklad kódu je určený pro použití s Windows Forms a vyžaduje PaintEventArgse, což je parametr obslužné rutiny události Paint. Kód provede následující akce:

  • Přeloží světovou transformační matici formuláře Windows Form vektorem (100, 0).

  • Otočí svět transformace úhlem 30 stupňů a připojí matici otáčení k světové transformační matici s Append.

  • Nakreslí přeložené otočené tři tečky modrým perem.

public:
   void RotateTransformAngleMatrixOrder( PaintEventArgs^ e )
   {
      // Set world transform of graphics object to translate.
      e->Graphics->TranslateTransform( 100.0F, 0.0F );

      // Then to rotate, appending rotation matrix.
      e->Graphics->RotateTransform( 30.0F, MatrixOrder::Append );

      // Draw translated, rotated ellipse to screen.
      e->Graphics->DrawEllipse( gcnew Pen( Color::Blue,3.0f ), 0, 0, 200, 80 );
   }
private void RotateTransformAngleMatrixOrder(PaintEventArgs e)
{

    // Set world transform of graphics object to translate.
    e.Graphics.TranslateTransform(100.0F, 0.0F);

    // Then to rotate, appending rotation matrix.
    e.Graphics.RotateTransform(30.0F, MatrixOrder.Append);

    // Draw translated, rotated ellipse to screen.
    e.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);
}
Private Sub RotateTransformAngleMatrixOrder(ByVal e As PaintEventArgs)

    ' Set world transform of graphics object to translate.
    e.Graphics.TranslateTransform(100.0F, 0.0F)

    ' Then to rotate, appending rotation matrix.
    e.Graphics.RotateTransform(30.0F, MatrixOrder.Append)

    ' Draw translated, rotated ellipse to screen.
    e.Graphics.DrawEllipse(New Pen(Color.Blue, 3), 0, 0, 200, 80)
End Sub

Poznámky

Operace otáčení se skládá z vynásobení transformační matice maticí, jejíž prvky jsou odvozeny z parametru angle. Tato metoda předpendí nebo připojí transformační matici Graphics maticí otočení podle parametru order.

Platí pro