PathGradientBrush.MultiplyTransform 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将表示此 PathGradientBrush 的局部几何转换的 Matrix 乘以指定 Matrix 前面指定 Matrix。
重载
MultiplyTransform(Matrix, MatrixOrder) |
使用画笔的转换矩阵乘以另一个矩阵来更新画笔的转换矩阵的乘积。 |
MultiplyTransform(Matrix) |
使用画笔的转换矩阵乘以另一个矩阵来更新画笔的转换矩阵。 |
MultiplyTransform(Matrix, MatrixOrder)
- Source:
- PathGradientBrush.cs
- Source:
- PathGradientBrush.cs
- Source:
- PathGradientBrush.cs
- Source:
- PathGradientBrush.cs
- Source:
- PathGradientBrush.cs
使用画笔的转换矩阵乘以另一个矩阵来更新画笔的转换矩阵的乘积。
public:
void MultiplyTransform(System::Drawing::Drawing2D::Matrix ^ matrix, System::Drawing::Drawing2D::MatrixOrder order);
public void MultiplyTransform (System.Drawing.Drawing2D.Matrix matrix, System.Drawing.Drawing2D.MatrixOrder order);
member this.MultiplyTransform : System.Drawing.Drawing2D.Matrix * System.Drawing.Drawing2D.MatrixOrder -> unit
Public Sub MultiplyTransform (matrix As Matrix, order As MatrixOrder)
参数
- order
- MatrixOrder
一个 MatrixOrder,指定将两个矩阵相乘的顺序。
示例
下面的代码示例旨在与 Windows 窗体一起使用,它需要 PaintEventArgse
OnPaint 事件对象。 该代码执行以下操作:
创建图形路径并为其添加一个矩形。
从路径点创建 PathGradientBrush(在此示例中,这些点构成矩形,但它可以是大多数形状)。
将中心颜色设置为红色,将周围颜色设置为蓝色。
在应用乘法转换之前,将 PathGradientBrush 绘制到屏幕。
创建矩阵,该矩阵旋转画笔 90 度,并在两个轴中将画笔平移 100。
使用 MultiplyTransform 方法将此矩阵应用于画笔。
将画笔绘制到屏幕。
public:
void MultiplyTransformExample( PaintEventArgs^ e )
{
// Create a graphics path and add an rectangle.
GraphicsPath^ myPath = gcnew GraphicsPath;
Rectangle rect = Rectangle(20,20,100,50);
myPath->AddRectangle( rect );
// Get the path's array of points.
array<PointF>^myPathPointArray = myPath->PathPoints;
// Create a path gradient brush.
PathGradientBrush^ myPGBrush = gcnew PathGradientBrush( myPathPointArray );
// Set the color span.
myPGBrush->CenterColor = Color::Red;
array<Color>^ mySurroundColor = {Color::Blue};
myPGBrush->SurroundColors = mySurroundColor;
// Draw the brush to the screen prior to transformation.
e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 200 );
// Create a new matrix that rotates by 90 degrees, and
// translates by 100 in each direction.
Matrix^ myMatrix = gcnew Matrix( 0,1,-1,0,100,100 );
// Apply the transform to the brush.
myPGBrush->MultiplyTransform( myMatrix, MatrixOrder::Append );
// Draw the brush to the screen again after applying the
// transform.
e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 300 );
}
public void MultiplyTransformExample(PaintEventArgs e)
{
// Create a graphics path and add an rectangle.
GraphicsPath myPath = new GraphicsPath();
Rectangle rect = new Rectangle(20, 20, 100, 50);
myPath.AddRectangle(rect);
// Get the path's array of points.
PointF[] myPathPointArray = myPath.PathPoints;
// Create a path gradient brush.
PathGradientBrush myPGBrush = new
PathGradientBrush(myPathPointArray);
// Set the color span.
myPGBrush.CenterColor = Color.Red;
Color[] mySurroundColor = {Color.Blue};
myPGBrush.SurroundColors = mySurroundColor;
// Draw the brush to the screen prior to transformation.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200);
// Create a new matrix that rotates by 90 degrees, and
// translates by 100 in each direction.
Matrix myMatrix = new Matrix(0, 1, -1, 0, 100, 100);
// Apply the transform to the brush.
myPGBrush.MultiplyTransform(myMatrix, MatrixOrder.Append);
// Draw the brush to the screen again after applying the
// transform.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 300);
}
Public Sub MultiplyTransformExample(ByVal e As PaintEventArgs)
' Create a graphics path and add a rectangle.
Dim myPath As New GraphicsPath
Dim rect As New Rectangle(20, 20, 100, 50)
myPath.AddRectangle(rect)
' Get the path's array of points.
Dim myPathPointArray As PointF() = myPath.PathPoints
' Create a path gradient brush.
Dim myPGBrush As New PathGradientBrush(myPathPointArray)
' Set the color span.
myPGBrush.CenterColor = Color.Red
Dim mySurroundColor As Color() = {Color.Blue}
myPGBrush.SurroundColors = mySurroundColor
' Draw the brush to the screen prior to transformation.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200)
' Create a new matrix that rotates by 90 degrees, and
' translates by 100 in each direction.
Dim myMatrix As New Matrix(0, 1, -1, 0, 100, 100)
' Apply the transform to the brush.
myPGBrush.MultiplyTransform(myMatrix, MatrixOrder.Append)
' Draw the brush to the screen again after applying the
' transform.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 300)
End Sub
适用于
MultiplyTransform(Matrix)
- Source:
- PathGradientBrush.cs
- Source:
- PathGradientBrush.cs
- Source:
- PathGradientBrush.cs
- Source:
- PathGradientBrush.cs
- Source:
- PathGradientBrush.cs
使用画笔的转换矩阵乘以另一个矩阵来更新画笔的转换矩阵。
public:
void MultiplyTransform(System::Drawing::Drawing2D::Matrix ^ matrix);
public void MultiplyTransform (System.Drawing.Drawing2D.Matrix matrix);
member this.MultiplyTransform : System.Drawing.Drawing2D.Matrix -> unit
Public Sub MultiplyTransform (matrix As Matrix)
参数
示例
有关示例,请参阅 MultiplyTransform。