TextureBrush.TranslateTransform 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
依照指定的順序,根據指定的維度來轉換此 TextureBrush物件的局部幾何轉換。
多載
TranslateTransform(Single, Single) |
根據指定的維度來轉譯此 TextureBrush 物件的局部幾何轉換。 這個方法會將轉譯附加到轉換之前。 |
TranslateTransform(Single, Single, MatrixOrder) |
依照指定的順序,根據指定的維度來轉換此 TextureBrush物件的局部幾何轉換。 |
TranslateTransform(Single, Single)
根據指定的維度來轉譯此 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 Forms 使用,而且需要 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物件的局部幾何轉換。
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 Forms 使用,而且需要 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
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應