TextureBrush.ResetTransform 方法

定義

將此 TextureBrush 物件的 Transform 屬性重設為單位矩陣。

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

範例

下列範例是專為搭配 Windows Forms 使用而設計,而且需要 PaintEventArgse,這是事件處理程序的參數Paint。 此程式碼會執行下列動作:

  • 建立 TextureBrush 物件。

  • 旋轉紋理影像 90 度。

  • 填滿矩形。

  • 將轉換矩陣重設為身分識別。

  • 填滿第二個矩形。

void ResetTransform_Example( PaintEventArgs^ e )
{
   // Create a TextureBrush object.
   TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) );

   // Rotate the texture image by 90 degrees.
   tBrush->RotateTransform( 90 );

   // Fill a rectangle with tBrush.
   e->Graphics->FillRectangle( tBrush, 0, 0, 100, 100 );

   // Reset transformation matrix to identity.
   tBrush->ResetTransform();

   // Fill a rectangle with tBrush.
   e->Graphics->FillRectangle( tBrush, 0, 110, 100, 100 );
}
public void ResetTransform_Example(PaintEventArgs e)
{
             
    // Create a TextureBrush object.
    TextureBrush tBrush = new TextureBrush(new Bitmap("texture.jpg"));
             
    // Rotate the texture image by 90 degrees.
    tBrush.RotateTransform(90);
             
    // Fill a rectangle with tBrush.
    e.Graphics.FillRectangle(tBrush, 0, 0, 100, 100);
             
    // Reset transformation matrix to identity.
    tBrush.ResetTransform();
             
    // Fill a rectangle with tBrush.
    e.Graphics.FillRectangle(tBrush, 0, 110, 100, 100);
}
Public Sub ResetTransform_Example(ByVal e As PaintEventArgs)

    ' Create a TextureBrush object.
    Dim tBrush As New TextureBrush(New Bitmap("texture.jpg"))

    ' Rotate the texture image by 90 degrees.
    tBrush.RotateTransform(90)

    ' Fill a rectangle with tBrush.
    e.Graphics.FillRectangle(tBrush, 0, 0, 100, 100)

    ' Reset transformation matrix to identity.
    tBrush.ResetTransform()

    ' Fill a rectangle with tBrush.
    e.Graphics.FillRectangle(tBrush, 0, 110, 100, 100)
End Sub
'ResetTransform_Example.

適用於