語言

PathGradientBrush.MultiplyTransform 方法

定義

將 Matrix 代表此 PathGradientBrush 局部幾何變換的 乘以指定 Matrix ,並加上指定的 Matrix。

多載

名稱 Description
MultiplyTransform(Matrix, MatrixOrder)

更新筆刷的轉換矩陣,將筆刷的轉換矩陣乘以另一個矩陣。

MultiplyTransform(Matrix)

更新筆刷的轉換矩陣,將筆刷的轉換矩陣乘以另一個矩陣。

MultiplyTransform(Matrix, MatrixOrder)

來源:
PathGradientBrush.cs
來源:
PathGradientBrush.cs
來源:
PathGradientBrush.cs
來源:
PathGradientBrush.cs
來源:
PathGradientBrush.cs
來源:
PathGradientBrush.cs
來源:
PathGradientBrush.cs
來源:
PathGradientBrush.cs
來源:
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)

參數

matrix
Matrix

這個 Matrix 會乘以刷子的電流變換矩陣。

order
MatrixOrder

A MatrixOrder 表示兩個矩陣相乘的順序。

範例

以下程式碼範例是為 Windows Forms 設計,並需要 PaintEventArgse,一個 OnPaint 事件物件。 此程式碼會執行下列動作:

  • 建立圖形路徑並加入一個矩形。

  • 從路徑點(在此例中,點形成矩形,但幾乎可以是任何形狀)建立 a PathGradientBrush 。

  • 將中心顏色設為紅色,周圍顏色設為藍色。

  • 在應用乘法轉換前,先 PathGradientBrush 將 畫到 螢幕上。

  • 建立 s 矩陣,將畫筆旋轉 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)

來源:
PathGradientBrush.cs
來源:
PathGradientBrush.cs
來源:
PathGradientBrush.cs
來源:
PathGradientBrush.cs
來源:
PathGradientBrush.cs
來源:
PathGradientBrush.cs
來源:
PathGradientBrush.cs
來源:
PathGradientBrush.cs
來源:
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)

參數

matrix
Matrix

這個 Matrix 會乘以刷子的電流變換矩陣。

範例

如需範例,請參閱 MultiplyTransform。

適用於