Condividi tramite


PathGradientBrush.MultiplyTransform Metodo

Definizione

Moltiplica il Matrix che rappresenta la trasformazione geometrica locale di questo PathGradientBrush dall'Matrix specificato anteponendo il Matrixspecificato.

Overload

MultiplyTransform(Matrix)

Aggiorna la matrice di trasformazione del pennello con il prodotto della matrice di trasformazione del pennello moltiplicato per un'altra matrice.

MultiplyTransform(Matrix, MatrixOrder)

Aggiorna la matrice di trasformazione del pennello con il prodotto della matrice di trasformazione del pennello moltiplicato per un'altra matrice.

MultiplyTransform(Matrix)

Origine:
PathGradientBrush.cs
Origine:
PathGradientBrush.cs
Origine:
PathGradientBrush.cs
Origine:
PathGradientBrush.cs
Origine:
PathGradientBrush.cs

Aggiorna la matrice di trasformazione del pennello con il prodotto della matrice di trasformazione del pennello moltiplicato per un'altra matrice.

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)

Parametri

matrix
Matrix

Il Matrix che verrà moltiplicato per la matrice di trasformazione corrente del pennello.

Esempio

Per un esempio, vedere MultiplyTransform.

Si applica a

MultiplyTransform(Matrix, MatrixOrder)

Origine:
PathGradientBrush.cs
Origine:
PathGradientBrush.cs
Origine:
PathGradientBrush.cs
Origine:
PathGradientBrush.cs
Origine:
PathGradientBrush.cs

Aggiorna la matrice di trasformazione del pennello con il prodotto della matrice di trasformazione del pennello moltiplicato per un'altra matrice.

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)

Parametri

matrix
Matrix

Il Matrix che verrà moltiplicato per la matrice di trasformazione corrente del pennello.

order
MatrixOrder

Oggetto MatrixOrder che specifica in quale ordine moltiplicare le due matrici.

Esempio

L'esempio di codice seguente è progettato per l'uso con Windows Form e richiede PaintEventArgse, un oggetto evento OnPaint. Il codice esegue le azioni seguenti:

  • Crea un percorso grafico e aggiunge un rettangolo.

  • Crea un PathGradientBrush dai punti del percorso ,in questo esempio i punti formano un rettangolo, ma potrebbero essere la maggior parte di qualsiasi forma.

  • Imposta il colore centrale sul rosso e sul colore circostante su blu.

  • Disegna il PathGradientBrush sullo schermo prima di applicare la trasformazione di moltiplicazione.

  • Crea una matrice che ruota il pennello di 90 gradi e la converte di 100 in entrambi gli assi.

  • Applica questa matrice al pennello usando il metodo MultiplyTransform.

  • Disegna il pennello sullo schermo.

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

Si applica a