PathGradientBrush.MultiplyTransform Metod

Definition

Multiplicerar Matrix det som representerar den lokala geometriska transformen av detta PathGradientBrush med angivet Matrix genom att vänta på den angivna Matrix.

Överlagringar

Name Description
MultiplyTransform(Matrix, MatrixOrder)

Uppdaterar penselns transformeringsmatris med produkten av penselns transformeringsmatris multiplicerad med en annan matris.

MultiplyTransform(Matrix)

Uppdaterar penselns transformeringsmatris med produkten av penselns transformeringsmatris multiplicerad med en annan matris.

MultiplyTransform(Matrix, MatrixOrder)

Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs

Uppdaterar penselns transformeringsmatris med produkten av penselns transformeringsmatris multiplicerad med en annan matris.

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)

Parametrar

matrix
Matrix

Det Matrix som multipliceras med penselns aktuella transformeringsmatris.

order
MatrixOrder

A MatrixOrder som anger i vilken ordning de två matriserna ska multipliceras.

Exempel

Följande kodexempel är utformat för användning med Windows Forms och kräver PaintEventArgse, ett OnPaint händelseobjekt. Koden utför följande åtgärder:

  • Skapar en grafiksökväg och lägger till en rektangel i den.

  • Skapar en PathGradientBrush från sökvägspunkterna (i det här exemplet bildar punkterna en rektangel, men det kan vara de flesta former).

  • Ställer in mittenfärgen till röd och den omgivande färgen till blå.

  • PathGradientBrush Ritar till skärmen innan du tillämpar multiplikationstransformen.

  • Skapar en matris som roterar penseln 90 grader och översätter den med 100 i båda axlarna.

  • Tillämpar den här matrisen på penseln med hjälp MultiplyTransform av metoden .

  • Ritar penseln till skärmen.

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

Gäller för

MultiplyTransform(Matrix)

Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs
Källa:
PathGradientBrush.cs

Uppdaterar penselns transformeringsmatris med produkten av penselns transformeringsmatris multiplicerad med en annan matris.

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)

Parametrar

matrix
Matrix

Det Matrix som multipliceras med penselns aktuella transformeringsmatris.

Exempel

Ett exempel finns i MultiplyTransform.

Gäller för