Pen.ResetTransform 方法
将此 Pen 的几何变换矩阵重置为单位矩阵。
**命名空间:**System.Drawing
**程序集:**System.Drawing(在 system.drawing.dll 中)
语法
声明
Public Sub ResetTransform
用法
Dim instance As Pen
instance.ResetTransform
public void ResetTransform ()
public:
void ResetTransform ()
public void ResetTransform ()
public function ResetTransform ()
返回值
此方法不返回值。
示例
下面的代码示例设计用于 Windows 窗体,它需要 PaintEventArgse(这是 Paint 事件处理程序的参数)。代码执行下列操作:
创建一个 Pen。
设置钢笔的变换矩阵,以便沿着 x 轴方向缩放 2 倍。
将一条线绘制到屏幕。
将变换矩阵重置为单位矩阵。
将第二条线绘制到屏幕。
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
平台
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 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
版本信息
.NET Framework
受以下版本支持:2.0、1.1、1.0