Freigeben über


PathGradientBrush.MultiplyTransform Methode

Definition

Multipliziert die Matrix, die die lokale geometrische Transformation dieses PathGradientBrush darstellt, mit der angegebenen Matrix, indem die angegebene Matrix vorangestellt wird.

Überlädt

MultiplyTransform(Matrix)

Aktualisiert die Transformationsmatrix des Pinsels mit dem Produkt der Multiplikation dieser Transformationsmatrix mit einer anderen Matrix.

MultiplyTransform(Matrix, MatrixOrder)

Aktualisiert die Transformationsmatrix des Pinsels mit dem Produkt der Multiplikation dieser Transformationsmatrix mit einer anderen Matrix.

MultiplyTransform(Matrix)

Quelle:
PathGradientBrush.cs
Quelle:
PathGradientBrush.cs
Quelle:
PathGradientBrush.cs

Aktualisiert die Transformationsmatrix des Pinsels mit dem Produkt der Multiplikation dieser Transformationsmatrix mit einer anderen Matrix.

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

Die mit der aktuellen Transformationsmatrix des Pinsels zu multiplizierende Matrix.

Beispiele

Ein Beispiel finden Sie unter MultiplyTransform.

Gilt für:

MultiplyTransform(Matrix, MatrixOrder)

Quelle:
PathGradientBrush.cs
Quelle:
PathGradientBrush.cs
Quelle:
PathGradientBrush.cs

Aktualisiert die Transformationsmatrix des Pinsels mit dem Produkt der Multiplikation dieser Transformationsmatrix mit einer anderen Matrix.

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

Die mit der aktuellen Transformationsmatrix des Pinsels zu multiplizierende Matrix.

order
MatrixOrder

Eine MatrixOrder, die angibt, in welcher Reihenfolge die beiden Matrizen multipliziert werden sollen.

Beispiele

Das folgende Codebeispiel ist für die Verwendung mit Windows Forms konzipiert und erfordert PaintEventArgse, ein OnPaint Ereignisobjekt. Der Code führt die folgenden Aktionen aus:

  • Erstellt einen Grafikpfad und fügt diesem ein Rechteck hinzu.

  • Erstellt eine PathGradientBrush aus den Pfadpunkten (in diesem Beispiel bilden die Punkte ein Rechteck, aber es kann sich in den meisten Fällen um eine beliebige Form handeln).

  • Legt die Mittlere Farbe auf Rot und die umgebende Farbe auf Blau fest.

  • Zeichnet vor PathGradientBrush dem Anwenden der Multiplikationstransformation auf den Bildschirm.

  • Erstellt eine s-Matrix, die den Pinsel um 90 Grad dreht und in beiden Achsen um 100 übersetzt.

  • Wendet diese Matrix mithilfe der -Methode auf den MultiplyTransform Pinsel an.

  • Zeichnet den Pinsel auf den Bildschirm.

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

Gilt für: