Bagikan melalui


PathGradientBrush.MultiplyTransform Metode

Definisi

Mengalikan Matrix yang mewakili transformasi geometrik lokal PathGradientBrush ini dengan Matrix yang ditentukan dengan menambahkan Matrixyang ditentukan sebelumnya.

Overload

MultiplyTransform(Matrix, MatrixOrder)

Memperbarui matriks transformasi kuas dengan produk matriks transformasi sikat dikalikan dengan matriks lain.

MultiplyTransform(Matrix)

Memperbarui matriks transformasi kuas dengan produk matriks transformasi sikat dikalikan dengan matriks lain.

MultiplyTransform(Matrix, MatrixOrder)

Sumber:
PathGradientBrush.cs
Sumber:
PathGradientBrush.cs
Sumber:
PathGradientBrush.cs
Sumber:
PathGradientBrush.cs
Sumber:
PathGradientBrush.cs

Memperbarui matriks transformasi kuas dengan produk matriks transformasi sikat dikalikan dengan matriks lain.

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)

Parameter

matrix
Matrix

Matrix yang akan dikalikan dengan matriks transformasi kuas saat ini.

order
MatrixOrder

MatrixOrder yang menentukan untuk mengalikan dua matriks.

Contoh

Contoh kode berikut dirancang untuk digunakan dengan Windows Forms, dan memerlukan PaintEventArgse, objek peristiwa OnPaint. Kode melakukan tindakan berikut:

  • Membuat jalur grafis dan menambahkan persegi panjang ke dalamnya.

  • Membuat PathGradientBrush dari titik jalur (dalam contoh ini, titik membentuk persegi panjang, tetapi bisa menjadi bentuk apa pun).

  • Mengatur warna tengah ke merah dan warna sekitarnya menjadi biru.

  • Menggambar PathGradientBrush ke layar sebelum menerapkan transformasi multiply.

  • Membuat matriks yang memutar kuas 90 derajat dan menerjemahkannya dengan 100 di kedua sumbu.

  • Menerapkan matriks ini ke kuas dengan menggunakan metode MultiplyTransform.

  • Menggambar kuas ke layar.

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

Berlaku untuk

MultiplyTransform(Matrix)

Sumber:
PathGradientBrush.cs
Sumber:
PathGradientBrush.cs
Sumber:
PathGradientBrush.cs
Sumber:
PathGradientBrush.cs
Sumber:
PathGradientBrush.cs

Memperbarui matriks transformasi kuas dengan produk matriks transformasi sikat dikalikan dengan matriks lain.

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)

Parameter

matrix
Matrix

Matrix yang akan dikalikan dengan matriks transformasi kuas saat ini.

Contoh

Misalnya, lihat MultiplyTransform.

Berlaku untuk