Share via


TextureBrush.ScaleTransform 方法

定義

以指定的數量來縮放這個 TextureBrush 物件的局部幾何轉換。 這個方法會將縮放矩陣附加到轉換之前。

多載

ScaleTransform(Single, Single)

以指定的數量來縮放這個 TextureBrush 物件的局部幾何轉換。 這個方法會將縮放矩陣附加到轉換之前。

ScaleTransform(Single, Single, MatrixOrder)

依照指定的順序,根據指定的量來縮放此 TextureBrush 物件的局部幾何轉換。

ScaleTransform(Single, Single)

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

以指定的數量來縮放這個 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 Forms 使用,而且需要 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.cs
來源:
TextureBrush.cs
來源:
TextureBrush.cs

依照指定的順序,根據指定的量來縮放此 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 Forms 使用,而且需要 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

適用於