この Region オブジェクトを指定の Matrix オブジェクトで変換します。
Public Sub Transform( _
ByVal matrix As Matrix _)
[C#]
public void Transform(Matrixmatrix);
[C++]
public: void Transform(Matrix* matrix);
[JScript]
public function Transform(
matrix : Matrix);
パラメータ
戻り値
このメソッドは値を返しません。
使用例
[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 Paint イベント ハンドラのパラメータである PaintEventArgs e が必要です。このコードは次のアクションを実行します。
- 四角形を作成し、青で画面に描画します。
- 四角形から領域を作成します。
- 変換行列を作成し、これを 45 度に設定します。
- 領域に変換を適用します。
- 変換領域を赤で塗りつぶした上で画面に赤で描画します。
[Visual Basic, C#] 赤の四角形は元の四角形から 45 度回転し、青で表示されます。
Public Sub TransformExample(e As PaintEventArgs)
' Create the first rectangle and draw it to the screen in blue.
Dim regionRect As New Rectangle(100, 50, 100, 100)
e.Graphics.DrawRectangle(Pens.Blue, regionRect)
' Create a region using the first rectangle.
Dim myRegion As New [Region](regionRect)
' Create a transform matrix and set it to have a 45 degree
' rotation.
Dim transformMatrix As New Matrix()
transformMatrix.RotateAt(45, New PointF(100, 50))
' Apply the transform to the region.
myRegion.Transform(transformMatrix)
' Fill the transformed region with red and draw it to the
' screen in red.
Dim myBrush As New SolidBrush(Color.Red)
e.Graphics.FillRegion(myBrush, myRegion)
End Sub
[C#]
public void TransformExample(PaintEventArgs e)
{
// Create the first rectangle and draw it to the screen in blue.
Rectangle regionRect = new Rectangle(100, 50, 100, 100);
e.Graphics.DrawRectangle(Pens.Blue, regionRect);
// Create a region using the first rectangle.
Region myRegion = new Region(regionRect);
// Create a transform matrix and set it to have a 45 degree
// rotation.
Matrix transformMatrix = new Matrix();
transformMatrix.RotateAt(45, new Point(100, 50));
// Apply the transform to the region.
myRegion.Transform(transformMatrix);
// Fill the transformed region with red and draw it to the screen
// in red.
SolidBrush myBrush = new SolidBrush(Color.Red);
e.Graphics.FillRegion(myBrush, myRegion);
}
[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 ファミリ