Pen.ResetTransform Metoda

Definice

Obnoví identitu matice geometrické transformace.Pen

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

Příklady

Následující příklad kódu je navržený pro použití s model Windows Forms a vyžaduje PaintEventArgse, což je parametr obslužné rutiny Paint události. Kód provede následující akce:

  • Vytvoří .Pen

  • Nastaví transformační matici pera na měřítko 2krát ve směru osy x.

  • Nakreslí čáru na obrazovku.

  • Resetuje transformační matici na identitu.

  • Nakreslí na obrazovku druhý řádek.

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

Platí pro