Export (0) Print
Expand All

Rect.Transform Method (Matrix)

Transforms the rectangle by applying the specified matrix.

Namespace:  System.Windows
Assembly:  WindowsBase (in WindowsBase.dll)

public void Transform(
	Matrix matrix
)

Parameters

matrix
Type: System.Windows.Media.Matrix

A matrix that specifies the transformation to apply.

The following example shows how to use the Transform(Matrix) method to transform a Rect structure by using a Matrix.

private Rect transformExample1()
{
    // Initialize new rectangle.
    Rect myRectangle = new Rect();

    // Set the Size property of the rectangle with a width of 200 
    // and a height of 60.
    myRectangle.Size = new Size(200, 60);

    // Creating a Matrix structure.
    Matrix myMatrix = new Matrix(0, 1, 1, 0, 20, 2);

    // The Transform method transforms this rectangle using the specified matrix.   
    // myRectangle location changed from 0,0 to 20, 2 and the size changed from 
    // 200,60 to 60,200.
    myRectangle.Transform(myMatrix);

    return myRectangle;

}

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

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.

Show:
© 2014 Microsoft