Rect::Transform Method (Rect, Matrix)
.NET Framework (current version)
Returns the rectangle that results from applying the specified matrix to the specified rectangle.
Assembly: WindowsBase (in WindowsBase.dll)
Parameters
- rect
-
Type:
System.Windows::Rect
A rectangle that is the basis for the transformation.
- matrix
-
Type:
System.Windows.Media::Matrix
A matrix that specifies the transformation to apply.
The following example shows how to use the Transform(Rect, Matrix) method to create a new Rect structure that results from applying a Matrix to an existing rectangle.
private Rect transformExample2() { // 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 the specified rectangle using the specified matrix // and returns the results. // resultRect is an alterned version of myRectangle with a location of 20,2 rather // then 0,0 and a size of 60,200 rather then 200,60. Rect resultRect = Rect.Transform(myRectangle,myMatrix); return resultRect; }
.NET Framework
Available since 3.0
Available since 3.0
Show: