PathGradientBrush.MultiplyTransform Método

Definição

Multiplica o Matrix que representa a transformada geométrica local de este PathGradientBrush por o especificado Matrix , prependendo o especificado Matrix.

Sobrecargas

Name Description
MultiplyTransform(Matrix)

Atualiza a matriz de transformação do pincel com o produto da matriz de transformação do pincel multiplicado por outra matriz.

MultiplyTransform(Matrix, MatrixOrder)

Atualiza a matriz de transformação do pincel com o produto da matriz de transformação do pincel multiplicado por outra matriz.

MultiplyTransform(Matrix)

Atualiza a matriz de transformação do pincel com o produto da matriz de transformação do pincel multiplicado por outra matriz.

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)

Parâmetros

matrix
Matrix

O Matrix que será multiplicado pela matriz de transformação atual da escova.

Exemplos

Para obter um exemplo, consulte MultiplyTransform.

Aplica-se a

MultiplyTransform(Matrix, MatrixOrder)

Atualiza a matriz de transformação do pincel com o produto da matriz de transformação do pincel multiplicado por outra matriz.

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)

Parâmetros

matrix
Matrix

O Matrix que será multiplicado pela matriz de transformação atual da escova.

order
MatrixOrder

A MatrixOrder que especifica em que ordem multiplicar as duas matrizes.

Exemplos

O seguinte exemplo de código foi concebido para uso com Windows Forms e requer PaintEventArgse, um objeto de evento OnPaint. O código executa as seguintes ações:

  • Cria um caminho gráfico e adiciona um retângulo a ele.

  • Cria um PathGradientBrush a partir dos pontos do caminho (neste exemplo, os pontos formam um retângulo, mas pode ser quase qualquer forma).

  • Define a cor central para vermelho e a cor circundante para azul.

  • Desenha o PathGradientBrush para o ecrã antes de aplicar a transformação de multiplicação.

  • Cria uma matriz S que roda a escova 90 graus e a traduz por 100 em ambos os eixos.

  • Aplica esta matriz ao pincel usando o MultiplyTransform método.

  • Puxa o pincel para o ecrã.

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

Aplica-se a