Matrix.Rotate 메서드

정의

원점과 관련된 지정된 각도의 시계 방향으로 회전을 적용 Matrix합니다.

오버로드

Name Description
Rotate(Single)

Matrix 점과 지정된 각도를 중심으로 시계 방향으로 회전합니다.

Rotate(Single, MatrixOrder)

매개 angle변수에 Matrix 지정된 양의 시계 방향으로 원점(x 및 y 좌표 0개)을 적용합니다.

Rotate(Single)

Matrix 점과 지정된 각도를 중심으로 시계 방향으로 회전합니다.

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

매개 변수

angle
Single

회전 각도(도)입니다.

예제

예제를 보려면 Rotate(Single, MatrixOrder)를 참조하세요.

적용 대상

Rotate(Single, MatrixOrder)

매개 angle변수에 Matrix 지정된 양의 시계 방향으로 원점(x 및 y 좌표 0개)을 적용합니다.

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

매개 변수

angle
Single

회전의 각도(익스텐트)(도)입니다.

order
MatrixOrder

MatrixOrder 회전이 적용되는 Matrix순서(추가 또는 앞에 추가)를 지정하는 A입니다.

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 Paint 이벤트 개체인 PaintEventArgse가 필요합니다. 코드는 다음 작업을 수행합니다.

  • 회전 변환(파란색 사각형)을 적용하기 전에 화면에 사각형을 그립니다.

  • 행렬을 만들고 45도 회전합니다.

  • 이 행렬 변환을 사각형에 적용합니다.

  • 변환된 사각형을 화면(빨간색 사각형)에 그립니다.

빨간색 사각형이 0, 0 화면 좌표를 중심으로 회전되었습니다.

public:
   void RotateExample( PaintEventArgs^ e )
   {
      Pen^ myPen = gcnew Pen( Color::Blue,1.0f );
      Pen^ myPen2 = gcnew Pen( Color::Red,1.0f );

      // Draw the rectangle to the screen before applying the transform.
      e->Graphics->DrawRectangle( myPen, 150, 50, 200, 100 );

      // Create a matrix and rotate it 45 degrees.
      Matrix^ myMatrix = gcnew Matrix;
      myMatrix->Rotate( 45, MatrixOrder::Append );

      // Draw the rectangle to the screen again after applying the
      // transform.
      e->Graphics->Transform = myMatrix;
      e->Graphics->DrawRectangle( myPen2, 150, 50, 200, 100 );
   }
public void RotateExample(PaintEventArgs e)
{
    Pen myPen = new Pen(Color.Blue, 1);
    Pen myPen2 = new Pen(Color.Red, 1);
             
    // Draw the rectangle to the screen before applying the transform.
    e.Graphics.DrawRectangle(myPen, 150, 50, 200, 100);
             
    // Create a matrix and rotate it 45 degrees.
    Matrix myMatrix = new Matrix();
    myMatrix.Rotate(45, MatrixOrder.Append);
             
    // Draw the rectangle to the screen again after applying the
             
    // transform.
    e.Graphics.Transform = myMatrix;
    e.Graphics.DrawRectangle(myPen2, 150, 50, 200, 100);
}
Public Sub RotateExample(ByVal e As PaintEventArgs)
    Dim myPen As New Pen(Color.Blue, 1)
    Dim myPen2 As New Pen(Color.Red, 1)

    ' Draw the rectangle to the screen before applying the transform.
    e.Graphics.DrawRectangle(myPen, 150, 50, 200, 100)

    ' Create a matrix and rotate it 45 degrees.
    Dim myMatrix As New Matrix
    myMatrix.Rotate(45, MatrixOrder.Append)

    ' Draw the rectangle to the screen again after applying the
    ' transform.
    e.Graphics.Transform = myMatrix
    e.Graphics.DrawRectangle(myPen2, 150, 50, 200, 100)
End Sub

적용 대상