語言

TextureBrush.TranslateTransform 方法

定義

將此 TextureBrush 物件的局部幾何變換轉換為指定尺寸且順序。

多載

名稱 Description
TranslateTransform(Single, Single)

將該 TextureBrush 物體的局部幾何變換換成指定尺寸。 此方法在轉換前置於平移前。

TranslateTransform(Single, Single, MatrixOrder)

將此 TextureBrush 物件的局部幾何變換轉換為指定尺寸且順序。

TranslateTransform(Single, Single)

來源:
TextureBrush.cs
來源:
TextureBrush.cs
來源:
TextureBrush.cs
來源:
TextureBrush.cs
來源:
TextureBrush.cs
來源:
TextureBrush.cs
來源:
TextureBrush.cs
來源:
TextureBrush.cs
來源:
TextureBrush.cs

將該 TextureBrush 物體的局部幾何變換換成指定尺寸。 此方法在轉換前置於平移前。

public:
 void TranslateTransform(float dx, float dy);
public void TranslateTransform(float dx, float dy);
member this.TranslateTransform : single * single -> unit
Public Sub TranslateTransform (dx As Single, dy As Single)

參數

dx
Single

將轉換在 x 方向上的平移維度。

dy
Single

將轉換在 y 方向平移的維度。

範例

以下範例是為 Windows 表單設計,並需要 PaintEventArgse,這是事件處理器的 Paint 參數。 此程式碼會執行下列動作:

  • 建立 TextureBrush 物件。

  • 將貼圖影像在 x 方向上轉換 50 單位。

  • 用貼圖刷填滿螢幕上的一個矩形。

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

   // Move the texture image 2X in the x-direction.
   tBrush->TranslateTransform( 50, 0, MatrixOrder::Prepend );

   // Fill a rectangle with tBrush.
   e->Graphics->FillRectangle( tBrush, 0, 0, 100, 100 );
}
public void TranslateTransform_Example1(PaintEventArgs e)
{
             
    // Create a TextureBrush object.
    TextureBrush tBrush = new TextureBrush(new Bitmap("texture.jpg"));
             
    // Move the texture image 2X in the x-direction.
    tBrush.TranslateTransform(50, 0, MatrixOrder.Prepend);
             
    // Fill a rectangle with tBrush.
    e.Graphics.FillRectangle(tBrush, 0, 0, 100, 100);
}
Public Sub TranslateTransform_Example1(ByVal e As PaintEventArgs)

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

    ' Move the texture image 2X in the x-direction.
    tBrush.TranslateTransform(50, 0, MatrixOrder.Prepend)

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

適用於

TranslateTransform(Single, Single, MatrixOrder)

來源:
TextureBrush.cs
來源:
TextureBrush.cs
來源:
TextureBrush.cs
來源:
TextureBrush.cs
來源:
TextureBrush.cs
來源:
TextureBrush.cs
來源:
TextureBrush.cs
來源:
TextureBrush.cs
來源:
TextureBrush.cs

將此 TextureBrush 物件的局部幾何變換轉換為指定尺寸且順序。

public:
 void TranslateTransform(float dx, float dy, System::Drawing::Drawing2D::MatrixOrder order);
public void TranslateTransform(float dx, float dy, System.Drawing.Drawing2D.MatrixOrder order);
member this.TranslateTransform : single * single * System.Drawing.Drawing2D.MatrixOrder -> unit
Public Sub TranslateTransform (dx As Single, dy As Single, order As MatrixOrder)

參數

dx
Single

將轉換在 x 方向上的平移維度。

dy
Single

將轉換在 y 方向平移的維度。

order
MatrixOrder

翻譯應用的順序(前置或附加)。

範例

以下範例是為 Windows 表單設計,並需要 PaintEventArgse,這是事件處理器的 Paint 參數。 此程式碼會執行下列動作:

  • 建立 TextureBrush 物件。

  • 將貼圖影像在 x 方向上轉換 50 單位。

  • 用貼圖刷填滿螢幕上的一個矩形。

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

   // Move the texture image 2X in the x-direction.
   tBrush->TranslateTransform( 50, 0 );

   // Fill a rectangle with tBrush.
   e->Graphics->FillRectangle( tBrush, 0, 0, 100, 100 );
}
public void TranslateTransform_Example2(PaintEventArgs e)
{
         
    // Create a TextureBrush object.
    TextureBrush tBrush = new TextureBrush(new Bitmap("texture.jpg"));
         
    // Move the texture image 2X in the x-direction.
    tBrush.TranslateTransform(50, 0);
         
    // Fill a rectangle with tBrush.
    e.Graphics.FillRectangle(tBrush, 0, 0, 100, 100);
}
Public Sub TranslateTransform_Example2(ByVal e As PaintEventArgs)

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

    ' Move the texture image 2X in the x-direction.
    tBrush.TranslateTransform(50, 0)

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

適用於