다음을 통해 공유


PathGradientBrush.RotateTransform 메서드

정의

로컬 기하학적 변환을 시계 방향으로 지정된 각도만큼 회전합니다.

오버로드

RotateTransform(Single)

지정된 각도만큼 로컬 기하학적 변환을 회전합니다. 이 메서드는 변환에 회전을 추가합니다.

RotateTransform(Single, MatrixOrder)

특정 순서대로 지정된 각도만큼 로컬 기하학적 변환을 회전합니다.

RotateTransform(Single)

Source:
PathGradientBrush.cs
Source:
PathGradientBrush.cs
Source:
PathGradientBrush.cs

지정된 각도만큼 로컬 기하학적 변환을 회전합니다. 이 메서드는 변환에 회전을 추가합니다.

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

매개 변수

angle
Single

회전 각도(범위)입니다.

예제

예제를 보려면 RotateTransform를 참조하세요.

적용 대상

RotateTransform(Single, MatrixOrder)

Source:
PathGradientBrush.cs
Source:
PathGradientBrush.cs
Source:
PathGradientBrush.cs

특정 순서대로 지정된 각도만큼 로컬 기하학적 변환을 회전합니다.

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 사용하도록 설계되었으며 이벤트 개체인 가 OnPaint 필요합니다PaintEventArgse. 코드는 다음 작업을 수행합니다.

  • 그래픽 경로를 만들고 사각형을 추가합니다.

  • 경로 지점에서 을 PathGradientBrush 만듭니다(이 예제에서는 점이 사각형을 형성하지만 대부분의 셰이프일 수 있음).

  • 가운데 색을 빨간색으로 설정하고 주변 색을 파란색으로 설정합니다.

  • PathGradientBrush 회전 변환을 적용하기 전에 를 화면에 그립니다.

  • 해당 메서드를 사용하여 브러시에 회전 변환을 RotateTransform 적용합니다.

  • 회전된 브러시(사각형)를 화면에 그립니다.

아래쪽 사각형은 번역 전에 그린 사각형과 비교하여 45도 회전됩니다.

public:
   void RotateTransformExample( PaintEventArgs^ e )
   {
      // Create a graphics path and add an ellipse.
      GraphicsPath^ myPath = gcnew GraphicsPath;
      Rectangle rect = Rectangle(100,20,100,50);
      myPath->AddRectangle( rect );

      // Get the path's array of points.
      array<PointF>^myPathPointArray = myPath->PathPoints;

      // Create a path gradient brush.
      PathGradientBrush^ myPGBrush = gcnew PathGradientBrush( myPathPointArray );

      // Set the color span.
      myPGBrush->CenterColor = Color::Red;
      array<Color>^ mySurroundColor = {Color::Blue};
      myPGBrush->SurroundColors = mySurroundColor;

      // Draw the brush to the screen prior to transformation.
      e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 200 );

      // Apply the rotate transform to the brush.
      myPGBrush->RotateTransform( 45, MatrixOrder::Append );

      // Draw the brush to the screen again after applying the
      // transform.
      e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 300 );
   }
public void RotateTransformExample(PaintEventArgs e)
{
             
    // Create a graphics path and add an ellipse.
    GraphicsPath myPath = new GraphicsPath();
    Rectangle rect = new Rectangle(100, 20, 100, 50);
    myPath.AddRectangle(rect);
             
    // Get the path's array of points.
    PointF[] myPathPointArray = myPath.PathPoints;
             
    // Create a path gradient brush.
    PathGradientBrush myPGBrush = new
        PathGradientBrush(myPathPointArray);
             
    // Set the color span.
    myPGBrush.CenterColor = Color.Red;
    Color[] mySurroundColor = {Color.Blue};
    myPGBrush.SurroundColors = mySurroundColor;
             
    // Draw the brush to the screen prior to transformation.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200);
             
    // Apply the rotate transform to the brush.
    myPGBrush.RotateTransform(45, MatrixOrder.Append);
             
    // Draw the brush to the screen again after applying the
    // transform.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 300);
}
Public Sub RotateTransformExample(ByVal e As PaintEventArgs)

    ' Create a graphics path and add a rectangle.
    Dim myPath As New GraphicsPath
    Dim rect As New Rectangle(100, 20, 100, 50)
    myPath.AddRectangle(rect)

    ' Get the path's array of points.
    Dim myPathPointArray As PointF() = myPath.PathPoints

    ' Create a path gradient brush.
    Dim myPGBrush As New PathGradientBrush(myPathPointArray)

    ' Set the color span.
    myPGBrush.CenterColor = Color.Red
    Dim mySurroundColor As Color() = {Color.Blue}
    myPGBrush.SurroundColors = mySurroundColor

    ' Draw the brush to the screen prior to transformation.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200)

    ' Apply the rotate transform to the brush.
    myPGBrush.RotateTransform(45, MatrixOrder.Append)

    ' Draw the brush to the screen again after applying the
    ' transform.
    e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 300)
End Sub

적용 대상