Graphics.RotateTransform Metoda

Definicja

Stosuje określoną rotację do macierzy przekształceń tego Graphicselementu .

Przeciążenia

RotateTransform(Single)

Stosuje określoną rotację do macierzy przekształceń tego Graphicselementu .

RotateTransform(Single, MatrixOrder)

Stosuje określoną rotację do macierzy przekształceń tej Graphics funkcji w określonej kolejności.

RotateTransform(Single)

Źródło:
Graphics.cs
Źródło:
Graphics.cs
Źródło:
Graphics.cs

Stosuje określoną rotację do macierzy przekształceń tego Graphicselementu .

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

Parametry

angle
Single

Kąt obrotu w stopniach.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgseparametru Paint programu obsługi zdarzeń. Kod wykonuje następujące akcje:

  • Tłumaczy macierz transformacji świata formularza systemu Windows według wektora (100, 0).

  • Obraca transformację świata kątem 30 stopni, co poprzedza macierz rotacji macierzy transformacji świata.

  • Rysuje obrócony, przetłumaczony wielokropek niebieskim piórem.

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

Uwagi

Operacja rotacji składa się z mnożenia macierzy przekształcania przez macierz, której elementy pochodzą z parametru angle . Ta metoda stosuje rotację, poprzedzając ją macierzy przekształceń.

Dotyczy

RotateTransform(Single, MatrixOrder)

Źródło:
Graphics.cs
Źródło:
Graphics.cs
Źródło:
Graphics.cs

Stosuje określoną rotację do macierzy przekształceń tej Graphics funkcji w określonej kolejności.

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

Kąt obrotu w stopniach.

order
MatrixOrder

Element członkowski MatrixOrder wyliczenia, który określa, czy rotacja jest dołączana, czy poprzedzana transformacją macierzy.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgseparametru Paint programu obsługi zdarzeń. Kod wykonuje następujące akcje:

  • Tłumaczy macierz transformacji świata formularza systemu Windows według wektora (100, 0).

  • Obraca świat przez kąt 30 stopni, dołączając macierz rotacji do macierzy transformacji świata za pomocą polecenia Append.

  • Rysuje przetłumaczony, obrócony wielokropek niebieskim piórem.

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

Uwagi

Operacja rotacji składa się z mnożenia macierzy przekształcania przez macierz, której elementy pochodzą z parametru angle . Ta metoda poprzedza lub dołącza macierz Graphics przekształcania przez macierz rotacji zgodnie z parametrem order .

Dotyczy