Pen.ResetTransform Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Resets the geometric transformation matrix for this Pen to identity.
public:
void ResetTransform();
public void ResetTransform();
member this.ResetTransform : unit -> unit
Public Sub ResetTransform ()
The following code example is designed for use with Windows Forms, and it requires PaintEventArgs e
, which is a parameter of the Paint event handler. The code performs the following actions:
Creates a Pen.
Sets the transformation matrix of the pen to scale 2 times in the x-axis direction.
Draws a line to the screen.
Resets the transformation matrix to identity.
Draws a second line to the screen.
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
Product | Versions |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided) |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: