Pen.ResetTransform メソッド

定義

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

public:
 void ResetTransform();
public void ResetTransform ();
member this.ResetTransform : unit -> unit
Public Sub ResetTransform ()

次のコード例は、Windows フォームで使用するように設計されており、イベント ハンドラーのPaintパラメーターである が必要PaintEventArgseです。 コードは、次のアクションを実行します。

  • Pen を作成します。

  • ペンの変換行列を x 軸方向に 2 回スケーリングするように設定します。

  • 画面に線を描画します。

  • 変換マトリックスを ID にリセットします。

  • 画面に 2 行目を描画します。

public:
   void ResetTransform_Example( PaintEventArgs^ e )
   {
      
      // Create a Pen object.
      Pen^ myPen = gcnew Pen( Color::Black,3.0f );
      
      // 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 );
   }
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);
}
Public Sub ResetTransform_Example(ByVal 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

適用対象