語言

Graphics.RotateTransform 方法

定義

將指定的旋轉應用於此 Graphics轉換矩陣。

多載

名稱 Description
RotateTransform(Single, MatrixOrder)

將指定的旋轉以指定順序應用於此 Graphics 變換矩陣。

RotateTransform(Single)

將指定的旋轉應用於此 Graphics轉換矩陣。

RotateTransform(Single, MatrixOrder)

來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs

將指定的旋轉以指定順序應用於此 Graphics 變換矩陣。

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)

參數

angle
Single

旋轉角以度為單位。

order
MatrixOrder

列 MatrixOrder 舉中指定旋轉是附加還是前置於矩陣轉換的列舉中。

範例

以下程式碼範例是為 Windows Forms 設計的,並需要 PaintEventArgse,這是 Paint 事件處理程序的參數。 此程式碼會執行下列動作:

  • 將 Windows Form 的世界轉換矩陣轉換為向量 (100, 0)。

  • 將世界轉換旋轉30度,並將旋轉矩陣附加於世界轉換矩陣中。Append

  • 使用藍色畫筆繪製翻譯的旋轉橢圓形。

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

備註

旋轉運算是將轉換矩陣乘以一個矩陣,該矩陣的元素由參數 angle 推導而來。 此方法依參數將 的轉換矩陣 Graphics 前置或附加旋轉矩陣 order 。

適用於

RotateTransform(Single)

來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs
來源:
Graphics.cs

將指定的旋轉應用於此 Graphics轉換矩陣。

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

參數

angle
Single

旋轉角以度為單位。

範例

以下程式碼範例是為 Windows Forms 設計的,並需要 PaintEventArgse,這是 Paint 事件處理程序的參數。 此程式碼會執行下列動作:

  • 將 Windows Form 的世界轉換矩陣轉換為向量 (100, 0)。

  • 將世界轉換旋轉30度角,將旋轉矩陣置於世界轉換矩陣之前。

  • 使用藍色畫筆繪製旋轉的翻譯橢圓形。

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

備註

旋轉運算是將轉換矩陣乘以一個矩陣,該矩陣的元素由參數 angle 推導而來。 此方法透過將旋轉置於轉換矩陣前來應用。

適用於