Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Pen.MultiplyTransform Method (Matrix, MatrixOrder)

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

Namespace:  System.Drawing
Assembly:  System.Drawing (in System.Drawing.dll)
public void MultiplyTransform(
	Matrix matrix,
	MatrixOrder order


Type: System.Drawing.Drawing2D.Matrix

The Matrix by which to multiply the transformation matrix.

Type: System.Drawing.Drawing2D.MatrixOrder

The order in which to perform the multiplication operation.

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

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.

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);

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.