Pen.ResetTransform Méthode

Définition

Rétablit l'identité de la matrice de transformation géométrique de ce Pen.

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

Exemples

L’exemple de code suivant est conçu pour être utilisé avec Windows Forms et nécessite PaintEventArgse, qui est un paramètre du Paint gestionnaire d’événements. Le code effectue les actions suivantes :

  • Crée un Pen.

  • Définit la matrice de transformation du stylet pour qu’elle soit mise à l’échelle 2 fois dans le sens de l’axe X.

  • Dessine une ligne à l’écran.

  • Réinitialise la matrice de transformation en identité.

  • Dessine une deuxième ligne à l’écran.

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

S’applique à