次の方法で共有


Matrix.RotateAt メソッド (Single, PointF, MatrixOrder)

指定した点を中心とする時計回りの回転を、指定した順序でこの Matrix オブジェクトに適用します。

Overloads Public Sub RotateAt( _
   ByVal angle As Single, _   ByVal point As PointF, _   ByVal order As MatrixOrder _)
[C#]
public void RotateAt(floatangle,PointFpoint,MatrixOrderorder);
[C++]
public: void RotateAt(floatangle,PointFpoint,MatrixOrderorder);
[JScript]
public function RotateAt(
   angle : float,point : PointF,order : MatrixOrder);

パラメータ

  • angle
    回転角度。
  • point
    回転の中心を表す PointF 構造体。
  • order
    回転を適用する順序 (前後どちらに付加するか) を指定する MatrixOrder 列挙体。

使用例

[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 OnPaint イベントのオブジェクトである PaintEventArgs e が必要です。このコードは次のアクションを実行します。

  • 回転の変換を適用する前に、画面に四角形を描画します (青い四角形)。
  • 行列を作成し、指定した点を中心にそれを 45 度回転します。
  • この行列変換を四角形に適用します。
  • 変形した四角形を画面に描画します (赤い四角形)。

[Visual Basic, C#] 赤い四角形は、四角形の左上隅 (RotateAt メソッドで指定した回転点) を中心に回転されます。

 
Public Sub RotateAtExample(e As PaintEventArgs)
Dim myPen As New Pen(Color.Blue, 1)
Dim myPen2 As New Pen(Color.Red, 1)
Dim rotatePoint As New PointF(150F, 50F)
' 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
        
[C#] 
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);
}
        

[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

Matrix クラス | Matrix メンバ | System.Drawing.Drawing2D 名前空間 | Matrix.RotateAt オーバーロードの一覧