次の方法で共有


Pen.ResetTransform メソッド

対象の Pen オブジェクトのジオメトリック変換行列を単位行列にリセットします。

Public Sub ResetTransform()
[C#]
public void ResetTransform();
[C++]
public: void ResetTransform();
[JScript]
public function ResetTransform();

戻り値

このメソッドは値を返しません。

使用例

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

  • Pen オブジェクトを作成します。
  • ペンの変換行列を設定して x 方向に 2 倍スケーリングします。
  • 画面に直線を描画します。
  • 変換行列を単位行列にリセットします。
  • 2 番目の直線を画面に描画します。
 
Public Sub ResetTransform_Example(e As PaintEventArgs)
' Create a Pen object.
Dim myPen As New Pen(Color.Black, 3)
' Scale the transformation matrix of myPen.
myPen.ScaleTransform(2, 1)
' Draw a line with myPen.
e.Graphics.DrawLine(myPen, 10, 0, 10, 200)
' Reset the transformation matrix of myPen to identity.
myPen.ResetTransform()
' Draw a second line with myPen.
e.Graphics.DrawLine(myPen, 100, 0, 100, 200)
End Sub
        
[C#] 
public void ResetTransform_Example(PaintEventArgs e)
{
// Create a Pen object.
Pen myPen = new Pen(Color.Black, 3);
// Scale the transformation matrix of myPen.
myPen.ScaleTransform(2, 1);
// Draw a line with myPen.
e.Graphics.DrawLine(myPen, 10, 0, 10, 200);
// Reset the transformation matrix of myPen to identity.
myPen.ResetTransform();
// Draw a second line with myPen.
e.Graphics.DrawLine(myPen, 100, 0, 100, 200);
}
        

[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 ファミリ

参照

Pen クラス | Pen メンバ | System.Drawing 名前空間