TextureBrush.ScaleTransform 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將此 TextureBrush 物件的局部幾何變換縮放為指定量。 此方法在變換前加上縮放矩陣。
多載
| 名稱 | Description |
|---|---|
| ScaleTransform(Single, Single) |
將此 TextureBrush 物件的局部幾何變換縮放為指定量。 此方法在變換前加上縮放矩陣。 |
| ScaleTransform(Single, Single, MatrixOrder) |
以指定數量和指定順序,將該 TextureBrush 物件的局部幾何變換縮放。 |
ScaleTransform(Single, Single)
將此 TextureBrush 物件的局部幾何變換縮放為指定量。 此方法在變換前加上縮放矩陣。
public:
void ScaleTransform(float sx, float sy);
public void ScaleTransform(float sx, float sy);
member this.ScaleTransform : single * single -> unit
Public Sub ScaleTransform (sx As Single, sy As Single)
參數
- sx
- Single
這是將轉換在 x 方向上縮放的量。
- sy
- Single
即在 y 方向上縮放變換的量。
範例
以下範例是為 Windows 表單設計,並需要 PaintEventArgse,這是事件處理器的 Paint 參數。 此程式碼會執行下列動作:
建立 TextureBrush 物件。
將貼圖影像在 x 方向上縮放兩倍。
用貼圖刷填滿螢幕上的一個矩形。
void ScaleTransform_Example1( PaintEventArgs^ e )
{
// Create a TextureBrush object.
TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) );
// Scale the texture image 2X in the x-direction.
tBrush->ScaleTransform( 2, 1 );
// Fill a rectangle with tBrush.
e->Graphics->FillRectangle( tBrush, 0, 0, 100, 100 );
}
public void ScaleTransform_Example1(PaintEventArgs e)
{
// Create a TextureBrush object.
TextureBrush tBrush = new TextureBrush(new Bitmap("texture.jpg"));
// Scale the texture image 2X in the x-direction.
tBrush.ScaleTransform(2, 1);
// Fill a rectangle with tBrush.
e.Graphics.FillRectangle(tBrush, 0, 0, 100, 100);
}
Public Sub ScaleTransform_Example1(ByVal e As PaintEventArgs)
' Create a TextureBrush object.
Dim tBrush As New TextureBrush(New Bitmap("texture.jpg"))
' Scale the texture image 2X in the x-direction.
tBrush.ScaleTransform(2, 1)
' Fill a rectangle with tBrush.
e.Graphics.FillRectangle(tBrush, 0, 0, 100, 100)
End Sub
適用於
ScaleTransform(Single, Single, MatrixOrder)
以指定數量和指定順序,將該 TextureBrush 物件的局部幾何變換縮放。
public:
void ScaleTransform(float sx, float sy, System::Drawing::Drawing2D::MatrixOrder order);
public void ScaleTransform(float sx, float sy, System.Drawing.Drawing2D.MatrixOrder order);
member this.ScaleTransform : single * single * System.Drawing.Drawing2D.MatrixOrder -> unit
Public Sub ScaleTransform (sx As Single, sy As Single, order As MatrixOrder)
參數
- sx
- Single
這是將轉換在 x 方向上縮放的量。
- sy
- Single
即在 y 方向上縮放變換的量。
- order
- MatrixOrder
一個 MatrixOrder 列舉,指定是否要加或加疊縮放矩陣。
範例
以下範例是為 Windows 表單設計,並需要 PaintEventArgse,這是事件處理器的 Paint 參數。 此程式碼會執行下列動作:
建立 TextureBrush 物件。
將貼圖影像在 x 方向上縮放兩倍。
用貼圖刷填滿螢幕上的一個矩形。
void ScaleTransform_Example2( PaintEventArgs^ e )
{
// Create a TextureBrush object.
TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) );
// Scale the texture image 2X in the x-direction.
tBrush->ScaleTransform( 2, 1, MatrixOrder::Prepend );
// Fill a rectangle with tBrush.
e->Graphics->FillRectangle( tBrush, 0, 0, 100, 100 );
}
public void ScaleTransform_Example2(PaintEventArgs e)
{
// Create a TextureBrush object.
TextureBrush tBrush = new TextureBrush(new Bitmap("texture.jpg"));
// Scale the texture image 2X in the x-direction.
tBrush.ScaleTransform(2, 1, MatrixOrder.Prepend);
// Fill a rectangle with tBrush.
e.Graphics.FillRectangle(tBrush, 0, 0, 100, 100);
}
Public Sub ScaleTransform_Example2(ByVal e As PaintEventArgs)
' Create a TextureBrush object.
Dim tBrush As New TextureBrush(New Bitmap("texture.jpg"))
' Scale the texture image 2X in the x-direction.
tBrush.ScaleTransform(2, 1, MatrixOrder.Prepend)
' Fill a rectangle with tBrush.
e.Graphics.FillRectangle(tBrush, 0, 0, 100, 100)
End Sub