Rect.Transform Methode

Definition

Transformiert ein Rechteck mithilfe der angegebenen Matrix.

Überlädt

Name Beschreibung
Transform(Matrix)

Transformiert das Rechteck, indem die angegebene Matrix angewendet wird.

Transform(Rect, Matrix)

Gibt das Rechteck zurück, das aus der Anwendung der angegebenen Matrix auf das angegebene Rechteck resultiert.

Transform(Matrix)

Transformiert das Rechteck, indem die angegebene Matrix angewendet wird.

public:
 void Transform(System::Windows::Media::Matrix matrix);
public void Transform(System.Windows.Media.Matrix matrix);
member this.Transform : System.Windows.Media.Matrix -> unit
Public Sub Transform (matrix As Matrix)

Parameter

matrix
Matrix

Eine Matrix, die die anzuwendende Transformation angibt.

Beispiele

Das folgende Beispiel zeigt, wie Sie mithilfe der Transform(Matrix) Methode eine Struktur mithilfe einer RectMatrix.

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

Gilt für:

Transform(Rect, Matrix)

Gibt das Rechteck zurück, das aus der Anwendung der angegebenen Matrix auf das angegebene Rechteck resultiert.

public:
 static System::Windows::Rect Transform(System::Windows::Rect rect, System::Windows::Media::Matrix matrix);
public static System.Windows.Rect Transform(System.Windows.Rect rect, System.Windows.Media.Matrix matrix);
static member Transform : System.Windows.Rect * System.Windows.Media.Matrix -> System.Windows.Rect
Public Shared Function Transform (rect As Rect, matrix As Matrix) As Rect

Parameter

rect
Rect

Ein Rechteck, das die Basis für die Transformation ist.

matrix
Matrix

Eine Matrix, die die anzuwendende Transformation angibt.

Gibt zurück

Das Rechteck, das aus dem Vorgang resultiert.

Beispiele

Das folgende Beispiel zeigt, wie Sie mit der Transform(Rect, Matrix) Methode eine neue Rect Struktur erstellen, die sich aus der Anwendung eines Matrix vorhandenen Rechtecks ergibt.

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

Gilt für: