Pen.RotateTransform Metoda

Definicja

Obraca lokalną transformację geometryczną według określonego kąta. Ta metoda poprzedza rotację przekształcenia.

Przeciążenia

RotateTransform(Single, MatrixOrder)

Obraca lokalne przekształcenie geometryczne według określonego kąta w określonej kolejności.

RotateTransform(Single)

Obraca lokalną transformację geometryczną według określonego kąta. Ta metoda poprzedza rotację przekształcenia.

RotateTransform(Single, MatrixOrder)

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

Obraca lokalne przekształcenie geometryczne według określonego kąta 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.

order
MatrixOrder

Element MatrixOrder określający, czy ma być dołączany lub poprzedzany macierz rotacji.

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:

  • Tworzy element Pen.

  • Skaluje pióro o 2 razy w kierunku osi x.

  • Rysuje prostokąt przy użyciu pióra.

  • Obraca pióro 90 stopni zgodnie z ruchem wskazówek zegara.

  • Rysuje drugi prostokąt, aby zademonstrować różnicę.

public:
   void RotateTransform_Example2( PaintEventArgs^ e )
   {
      
      // Create a Pen object.
      Pen^ rotatePen = gcnew Pen( Color::Black,5.0f );
      
      // Scale rotatePen by 2X in the x-direction.
      rotatePen->ScaleTransform( 2, 1 );
      
      // Draw a rectangle with rotatePen.
      e->Graphics->DrawRectangle( rotatePen, 10, 10, 100, 100 );
      
      // Rotate rotatePen 90 degrees clockwise.
      rotatePen->RotateTransform( 90, MatrixOrder::Append );
      
      // Draw a second rectangle with rotatePen.
      e->Graphics->DrawRectangle( rotatePen, 120, 10, 100, 100 );
   }
public void RotateTransform_Example2(PaintEventArgs e)
{
             
    // Create a Pen object.
    Pen rotatePen = new Pen(Color.Black, 5);
             
    // Scale rotatePen by 2X in the x-direction.
    rotatePen.ScaleTransform(2, 1);
             
    // Draw a rectangle with rotatePen.
    e.Graphics.DrawRectangle(rotatePen, 10, 10, 100, 100);
             
    // Rotate rotatePen 90 degrees clockwise.
    rotatePen.RotateTransform(90, MatrixOrder.Append);
             
    // Draw a second rectangle with rotatePen.
    e.Graphics.DrawRectangle(rotatePen, 120, 10, 100, 100);
}
Public Sub RotateTransform_Example2(ByVal e As PaintEventArgs)

    ' Create a Pen object.
    Dim rotatePen As New Pen(Color.Black, 5)

    ' Scale rotatePen by 2X in the x-direction.
    rotatePen.ScaleTransform(2, 1)

    ' Draw a rectangle with rotatePen.
    e.Graphics.DrawRectangle(rotatePen, 10, 10, 100, 100)

    ' Rotate rotatePen 90 degrees clockwise.
    rotatePen.RotateTransform(90, MatrixOrder.Append)

    ' Draw a second rectangle with rotatePen.
    e.Graphics.DrawRectangle(rotatePen, 120, 10, 100, 100)
End Sub

Uwagi

Ponieważ kształt pióra jest okrągły, obrót nie ma żadnego widocznego efektu, chyba że pióro jest skalowane w kierunku osi x lub y.

Dotyczy

RotateTransform(Single)

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

Obraca lokalną transformację geometryczną według określonego kąta. Ta metoda poprzedza rotację przekształcenia.

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.

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:

  • Tworzy element Pen.

  • Rysuje prostokąt przy użyciu pióra.

  • Skaluje pióro o 2 razy w kierunku osi x.

  • Obraca pióro 90 stopni zgodnie z ruchem wskazówek zegara.

  • Rysuje drugi prostokąt, aby zademonstrować różnicę.

public:
   void RotateTransform_Example1( PaintEventArgs^ e )
   {
      
      // Create a Pen object.
      Pen^ rotatePen = gcnew Pen( Color::Black,5.0f );
      
      // Draw a rectangle with rotatePen.
      e->Graphics->DrawRectangle( rotatePen, 10, 10, 100, 100 );
      
      // Scale rotatePen by 2X in the x-direction.
      rotatePen->ScaleTransform( 2, 1 );
      
      // Rotate rotatePen 90 degrees clockwise.
      rotatePen->RotateTransform( 90 );
      
      // Draw a second rectangle with rotatePen.
      e->Graphics->DrawRectangle( rotatePen, 140, 10, 100, 100 );
   }
public void RotateTransform_Example1(PaintEventArgs e)
{
             
    // Create a Pen object.
    Pen rotatePen = new Pen(Color.Black, 5);
             
    // Draw a rectangle with rotatePen.
    e.Graphics.DrawRectangle(rotatePen, 10, 10, 100, 100);
             
    // Scale rotatePen by 2X in the x-direction.
    rotatePen.ScaleTransform(2, 1);
             
    // Rotate rotatePen 90 degrees clockwise.
    rotatePen.RotateTransform(90);
             
    // Draw a second rectangle with rotatePen.
    e.Graphics.DrawRectangle(rotatePen, 140, 10, 100, 100);
}
Public Sub RotateTransform_Example1(ByVal e As PaintEventArgs)

    ' Create a Pen object.
    Dim rotatePen As New Pen(Color.Black, 5)

    ' Draw a rectangle with rotatePen.
    e.Graphics.DrawRectangle(rotatePen, 10, 10, 100, 100)

    ' Scale rotatePen by 2X in the x-direction.
    rotatePen.ScaleTransform(2, 1)

    ' Rotate rotatePen 90 degrees clockwise.
    rotatePen.RotateTransform(90)

    ' Draw a second rectangle with rotatePen.
    e.Graphics.DrawRectangle(rotatePen, 140, 10, 100, 100)
End Sub

Uwagi

Ponieważ kształt pióra jest okrągły, obrót nie ma żadnego widocznego efektu, chyba że pióro jest skalowane w kierunku osi x lub y.

Dotyczy