Pen.ResetTransform-Methode
Setzt die geometrische Transformationsmatrix für diesen Pen auf Identität zurück.
Namespace: System.Drawing
Assembly: System.Drawing (in system.drawing.dll)
Syntax
'Declaration
Public Sub ResetTransform
'Usage
Dim instance As Pen
instance.ResetTransform
public void ResetTransform ()
public:
void ResetTransform ()
public void ResetTransform ()
public function ResetTransform ()
Rückgabewert
Diese Methode gibt keinen Wert zurück.
Beispiel
Das folgende Codebeispiel ist für die Verwendung mit Windows Forms vorgesehen und erfordert PaintEventArgse, wobei es sich um einen Parameter des Paint-Ereignishandlers handelt. Der Code führt die folgenden Aktionen aus:
Erstellt einen Pen.
Legt die Transformationsmatrix des Stiftes auf zweifache Skalierung in Richtung der x-Achse fest.
Zeichnet eine Linie auf dem Bildschirm.
Setzt die Transformationsmatrix auf Identität zurück.
Zeichnet eine zweite Linie auf dem Bildschirm.
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
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:
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.get_Black(), 3);
// Scale the transformation matrix of myPen.
myPen.ScaleTransform(2, 1);
// Draw a line with myPen.
e.get_Graphics().DrawLine(myPen, 10, 0, 10, 200);
// Reset the transformation matrix of myPen to identity.
myPen.ResetTransform();
// Draw a second line with myPen.
e.get_Graphics().DrawLine(myPen, 100, 0, 100, 200);
} //ResetTransform_Example
Plattformen
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0