次の方法で共有


PathGradientBrush.RotateTransform メソッド

定義

ローカル ジオメトリック変換に、指定した角度の時計回りの回転を適用します。

オーバーロード

RotateTransform(Single)

指定した分量だけローカル ジオメトリック変換を回転します。 このメソッドは変換の前に回転を行います。

RotateTransform(Single, MatrixOrder)

指定した順序で、指定した分量だけローカル ジオメトリック変換を回転します。

RotateTransform(Single)

ソース:
PathGradientBrush.cs
ソース:
PathGradientBrush.cs
ソース:
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)

ソース:
PathGradientBrush.cs
ソース:
PathGradientBrush.cs
ソース:
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 フォームで使用するように設計されており、イベント オブジェクトが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

適用対象