Udostępnij za pośrednictwem


PathGradientBrush.MultiplyTransform Metoda

Definicja

Mnoży Matrix reprezentującą lokalną transformację geometryczną tego PathGradientBrush przez określony Matrix przez poprzedzanie określonego Matrix.

Przeciążenia

MultiplyTransform(Matrix)

Aktualizuje macierz przekształceń pędzla za pomocą produktu macierzy transformacji pędzla pomnożonej przez inną macierz.

MultiplyTransform(Matrix, MatrixOrder)

Aktualizuje macierz przekształcania pędzla za pomocą produktu macierzy przekształcania pędzla pomnożonej przez inną macierz.

MultiplyTransform(Matrix)

Źródło:
PathGradientBrush.cs
Źródło:
PathGradientBrush.cs
Źródło:
PathGradientBrush.cs
Źródło:
PathGradientBrush.cs
Źródło:
PathGradientBrush.cs

Aktualizuje macierz przekształceń pędzla za pomocą produktu macierzy transformacji pędzla pomnożonej przez inną macierz.

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)

Parametry

matrix
Matrix

Matrix, które zostaną pomnożone przez bieżącą macierz transformacji pędzla.

Przykłady

Aby zapoznać się z przykładem, zobacz MultiplyTransform.

Dotyczy

MultiplyTransform(Matrix, MatrixOrder)

Źródło:
PathGradientBrush.cs
Źródło:
PathGradientBrush.cs
Źródło:
PathGradientBrush.cs
Źródło:
PathGradientBrush.cs
Źródło:
PathGradientBrush.cs

Aktualizuje macierz przekształcania pędzla za pomocą produktu macierzy przekształcania pędzla pomnożonej przez inną macierz.

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)

Parametry

matrix
Matrix

Matrix, które zostaną pomnożone przez bieżącą macierz transformacji pędzla.

order
MatrixOrder

MatrixOrder, który określa, w której kolejności należy pomnożyć dwie macierze.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z formularzami Systemu Windows i wymaga PaintEventArgse, obiektu zdarzenia OnPaint. Kod wykonuje następujące akcje:

  • Tworzy ścieżkę grafiki i dodaje do niej prostokąt.

  • Tworzy PathGradientBrush z punktów ścieżki (w tym przykładzie punkty tworzą prostokąt, ale może to być najbardziej dowolny kształt).

  • Ustawia kolor środkowy na czerwony i otaczający kolor na niebieski.

  • Rysuje PathGradientBrush na ekranie przed zastosowaniem przekształcenia mnożenia.

  • Tworzy macierz, która obraca szczotkę 90 stopni i tłumaczy ją o 100 w obu osiach.

  • Stosuje tę macierz do pędzla przy użyciu metody MultiplyTransform.

  • Rysuje szczotkę do ekranu.

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

Dotyczy