Прочетете на английски Редактиране

Споделяне чрез


Pen.MultiplyTransform Method

Definition

Multiplies the transformation matrix for this Pen by the specified Matrix.

Overloads

MultiplyTransform(Matrix)

Multiplies the transformation matrix for this Pen by the specified Matrix.

MultiplyTransform(Matrix, MatrixOrder)

Multiplies the transformation matrix for this Pen by the specified Matrix in the specified order.

MultiplyTransform(Matrix)

Source:
Pen.cs
Source:
Pen.cs
Source:
Pen.cs
Source:
Pen.cs
Source:
Pen.cs
Source:
Pen.cs

Multiplies the transformation matrix for this Pen by the specified Matrix.

C#
public void MultiplyTransform(System.Drawing.Drawing2D.Matrix matrix);

Parameters

matrix
Matrix

The Matrix object by which to multiply the transformation matrix.

Examples

The following code example is designed for use with Windows Forms, and it requires PaintEventArgs e, which is a parameter of the Paint event handler. The code performs the following actions:

  • Creates a Pen.

  • Draws a line to the screen.

  • Multiplies the transformation matrix of the pen by the specified matrix.

  • Draws a line with the transformed pen.

C#
public void MultiplyTransform_Example1(PaintEventArgs e)
{
             
    // Create a Pen object.
    Pen myPen = new Pen(Color.Black, 5);
             
    // Create a translation matrix.
    Matrix penMatrix = new Matrix();
    penMatrix.Scale(3, 1);
             
    // Multiply the transformation matrix of myPen by transMatrix.
    myPen.MultiplyTransform(penMatrix);
             
    // Draw a line to the screen.
    e.Graphics.DrawLine(myPen, 0, 0, 100, 100);
}

Remarks

This method prepends the multiplication matrix specified in the matrix parameter to the transformation matrix for the multiplication operation.

Applies to

.NET 10 (package-provided) и други версии
Продукт Версии
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

MultiplyTransform(Matrix, MatrixOrder)

Source:
Pen.cs
Source:
Pen.cs
Source:
Pen.cs
Source:
Pen.cs
Source:
Pen.cs
Source:
Pen.cs

Multiplies the transformation matrix for this Pen by the specified Matrix in the specified order.

C#
public void MultiplyTransform(System.Drawing.Drawing2D.Matrix matrix, System.Drawing.Drawing2D.MatrixOrder order);

Parameters

matrix
Matrix

The Matrix by which to multiply the transformation matrix.

order
MatrixOrder

The order in which to perform the multiplication operation.

Examples

The following code example is designed for use with Windows Forms, and it requires PaintEventArgs e, which is a parameter of the Paint event handler. The code performs the following actions:

  • Creates a Pen.

  • Draws a line to the screen.

  • Multiplies the transformation matrix of the pen by the specified matrix.

  • Draws a line with the transformed pen.

C#
public void MultiplyTransform_Example2(PaintEventArgs e)
{
             
    // Create a Pen object.
    Pen myPen = new Pen(Color.Black, 5);
             
    // Create a translation matrix.
    Matrix penMatrix = new Matrix();
    penMatrix.Scale(3, 1);
             
    // Multiply the transformation matrix of myPen by transMatrix.
    myPen.MultiplyTransform(penMatrix, MatrixOrder.Prepend);
             
    // Draw a line to the screen.
    e.Graphics.DrawLine(myPen, 0, 0, 100, 100);
}

Remarks

This method uses the MatrixOrder enumeration element (either prepend or append) specified by the order parameter to carry out the multiplication operation.

Applies to

.NET 10 (package-provided) и други версии
Продукт Версии
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10