Language

Matrix.RotateAt メソッド

定義

回転を開始することによって、指定した点を中心に時計回りの回転をこの Matrix に適用します。

オーバーロード

名前 説明
RotateAt(Single, PointF)

この Matrix に、point パラメーターで指定された点を中心に、回転の前に時計回りの回転を適用します。

RotateAt(Single, PointF, MatrixOrder)

指定した順序で、指定した点を中心に時計回りの回転をこの Matrix に適用します。

RotateAt(Single, PointF)

ソース:
Matrix.cs
ソース:
Matrix.cs
ソース:
Matrix.cs
ソース:
Matrix.cs
ソース:
Matrix.cs
ソース:
Matrix.cs
ソース:
Matrix.cs
ソース:
Matrix.cs
ソース:
Matrix.cs

この Matrix に、point パラメーターで指定された点を中心に、回転の前に時計回りの回転を適用します。

public:
 void RotateAt(float angle, System::Drawing::PointF point);
public void RotateAt(float angle, System.Drawing.PointF point);
member this.RotateAt : single * System.Drawing.PointF -> unit
Public Sub RotateAt (angle As Single, point As PointF)

パラメーター

angle
Single

回転の角度 (範囲) を度単位で指定します。

point
PointF

回転の中心を表す PointF 。

例

次のコード例では、 Matrix と Transform メソッドを使用して文字列を回転する方法を示します。 この例は、Windows フォームで使用するように設計されています。 フォームを作成し、次のコードを貼り付けます。 フォームのDrawVerticalStringFromBottomUp イベント ハンドラーでPaint メソッドを呼び出し、eをPaintEventArgsとして渡します。

private:
   void DrawVerticalStringFromBottomUp( PaintEventArgs^ e )
   {
      // Create the string to draw on the form.
      String^ text = "Can you read this?";

      // Create a GraphicsPath.
      System::Drawing::Drawing2D::GraphicsPath^ path = gcnew System::Drawing::Drawing2D::GraphicsPath;

      // Add the string to the path; declare the font, font style, size, and
      // vertical format for the string.
      path->AddString( text, this->Font->FontFamily, 1, 15, PointF(0.0F,0.0F), gcnew StringFormat( StringFormatFlags::DirectionVertical ) );

      // Declare a matrix that will be used to rotate the text.
      System::Drawing::Drawing2D::Matrix^ rotateMatrix = gcnew System::Drawing::Drawing2D::Matrix;

      // Set the rotation angle and starting point for the text.
      rotateMatrix->RotateAt( 180.0F, PointF(10.0F,100.0F) );

      // Transform the text with the matrix.
      path->Transform(rotateMatrix);

      // Set the SmoothingMode to high quality for best readability.
      e->Graphics->SmoothingMode = System::Drawing::Drawing2D::SmoothingMode::HighQuality;

      // Fill in the path to draw the string.
      e->Graphics->FillPath( Brushes::Red, path );

      // Dispose of the path.
      delete path;
   }
public void DrawVerticalStringFromBottomUp(PaintEventArgs e)
{

    // Create the string to draw on the form.
    string text = "Can you read this?";

    // Create a GraphicsPath.
    System.Drawing.Drawing2D.GraphicsPath path = 
        new System.Drawing.Drawing2D.GraphicsPath();

    // Add the string to the path; declare the font, font style, size, and
    // vertical format for the string.
    path.AddString(text, this.Font.FontFamily, 1, 15, 
        new PointF(0.0F, 0.0F), 
        new StringFormat(StringFormatFlags.DirectionVertical));

    // Declare a matrix that will be used to rotate the text.
    System.Drawing.Drawing2D.Matrix rotateMatrix = 
        new System.Drawing.Drawing2D.Matrix();

    // Set the rotation angle and starting point for the text.
    rotateMatrix.RotateAt(180.0F, new PointF(10.0F, 100.0F));

    // Transform the text with the matrix.
    path.Transform(rotateMatrix);

    // Set the SmoothingMode to high quality for best readability.
    e.Graphics.SmoothingMode = 
        System.Drawing.Drawing2D.SmoothingMode.HighQuality;

    // Fill in the path to draw the string.
    e.Graphics.FillPath(Brushes.Red, path);

    // Dispose of the path.
    path.Dispose();
}
Public Sub DrawVerticalStringFromBottomUp(ByVal e As PaintEventArgs)

    ' Create the string to draw on the form.
    Dim text As String = "Can you read this?"

    ' Create a GraphicsPath.
    Dim path As New System.Drawing.Drawing2D.GraphicsPath

    ' Add the string to the path; declare the font, font style, size, and
    ' vertical format for the string.
    path.AddString(text, Me.Font.FontFamily, 1, 15, New PointF(0.0F, 0.0F), _
        New StringFormat(StringFormatFlags.DirectionVertical))

    ' Declare a matrix that will be used to rotate the text.
    Dim rotateMatrix As New System.Drawing.Drawing2D.Matrix

    ' Set the rotation angle and starting point for the text.
    rotateMatrix.RotateAt(180.0F, New PointF(10.0F, 100.0F))

    ' Transform the text with the matrix.
    path.Transform(rotateMatrix)

    ' Set the SmoothingMode to high quality for best readability.
    e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality

    ' Fill in the path to draw the string.
    e.Graphics.FillPath(Brushes.Red, path)

    ' Dispose of the path.
    path.Dispose()

End Sub

適用対象

RotateAt(Single, PointF, MatrixOrder)

ソース:
Matrix.cs
ソース:
Matrix.cs
ソース:
Matrix.cs
ソース:
Matrix.cs
ソース:
Matrix.cs
ソース:
Matrix.cs
ソース:
Matrix.cs
ソース:
Matrix.cs
ソース:
Matrix.cs

指定した順序で、指定した点を中心に時計回りの回転をこの Matrix に適用します。

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

パラメーター

angle
Single

回転の角度を度単位で指定します。

point
PointF

回転の中心を表す PointF 。

order
MatrixOrder

回転が適用される順序 (追加または先頭) を指定する MatrixOrder 。

例

次のコード例は、Windows フォームで使用できるように設計されており、PaintEventArgs イベント オブジェクトである ePaint が必要です。 コードは次のアクションを実行します。

  • 回転変換 (青い四角形) を適用する前に、画面に四角形を描画します。

  • 行列を作成し、指定した点を中心に 45 度回転します。

  • この行列変換を四角形に適用します。

  • 変換された四角形 (赤い四角形) を画面に描画します。

赤い四角形が四角形の左上隅を中心に回転していることに注目してください (回転ポイントは、 RotateAt メソッドを指定しました)。

public:
   void RotateAtExample( PaintEventArgs^ e )
   {
      Pen^ myPen = gcnew Pen( Color::Blue,1.0f );
      Pen^ myPen2 = gcnew Pen( Color::Red,1.0f );
      PointF rotatePoint = PointF(150.0f,50.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->RotateAt( 45, rotatePoint, 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 RotateAtExample(PaintEventArgs e)
{
    Pen myPen = new Pen(Color.Blue, 1);
    Pen myPen2 = new Pen(Color.Red, 1);
    PointF rotatePoint = new PointF(150.0f, 50.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 = new Matrix();
    myMatrix.RotateAt(45, rotatePoint, 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 RotateAtExample(ByVal e As PaintEventArgs)
    Dim myPen As New Pen(Color.Blue, 1)
    Dim myPen2 As New Pen(Color.Red, 1)
    Dim rotatePoint As New PointF(150.0F, 50.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.
    Dim myMatrix As New Matrix
    myMatrix.RotateAt(45, rotatePoint, 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

適用対象