Matrix.Rotate 메서드

정의

원점을 기준으로 지정된 각도만큼 이 Matrix에 시계 방향 회전을 적용합니다.

오버로드

Rotate(Single)

원점을 기준으로 지정된 각도만큼 이 Matrix 앞에 시계 방향 회전을 추가합니다.

Rotate(Single, MatrixOrder)

원점(X 및 Y 좌표가 0임)을 기준으로 angle 매개 변수에 지정된 각도만큼 이 Matrix에 시계 방향 회전을 적용합니다.

Rotate(Single)

Source:
Matrix.cs
Source:
Matrix.cs
Source:
Matrix.cs

원점을 기준으로 지정된 각도만큼 이 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)

Source:
Matrix.cs
Source:
Matrix.cs
Source:
Matrix.cs

원점(X 및 Y 좌표가 0임)을 기준으로 angle 매개 변수에 지정된 각도만큼 이 Matrix에 시계 방향 회전을 적용합니다.

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입니다.

예제

다음 코드 예제는 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

적용 대상