Graphics.RotateTransform Metoda

Definice

Použije zadanou rotaci na transformační matici této Graphics.

Přetížení

RotateTransform(Single)

Použije zadanou rotaci na transformační matici této Graphics.

RotateTransform(Single, MatrixOrder)

Použije zadanou rotaci na transformační matici v Graphics zadaném pořadí.

RotateTransform(Single)

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

Použije zadanou rotaci na transformační matici této 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 otočení ve stupních.

Příklady

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

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

  • Otočí transformaci světa úhlem 30 stupňů a předsouvá matici otáčení do matice transformace světa.

  • 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 rotaci tak, že ji předsadí na transformační matici.

Platí pro

RotateTransform(Single, MatrixOrder)

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

Použije zadanou rotaci na transformační matici v Graphics 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 otočení ve stupních.

order
MatrixOrder

Člen výčtu MatrixOrder , který určuje, zda je otočení připojeno nebo předem k transformaci matice.

Příklady

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

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

  • Otočí transformaci světa úhlem 30 stupňů a připojí rotační matici k matici transformace světa pomocí 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ředependuje nebo připojí transformační matici Graphics pomocí rotační matice podle parametru order .

Platí pro