TextureBrush.ScaleTransform 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将此 TextureBrush 对象的局部几何变换缩放指定的倍数。 此方法将缩放矩阵添加到转换前。
重载
ScaleTransform(Single, Single) |
将此 TextureBrush 对象的局部几何变换缩放指定的倍数。 此方法将缩放矩阵添加到转换前。 |
ScaleTransform(Single, Single, MatrixOrder) |
以指定顺序将此 TextureBrush 对象的局部几何转换按指定量进行缩放。 |
ScaleTransform(Single, Single)
- Source:
- TextureBrush.cs
- Source:
- TextureBrush.cs
- Source:
- 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 窗体 一起使用,它需要 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)
- Source:
- TextureBrush.cs
- Source:
- TextureBrush.cs
- Source:
- 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 窗体 一起使用,它需要 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
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈