Afficher en anglais

Partage via


Rect.Transform Méthode

Définition

Transforme un rectangle en utilisant la matrice spécifiée.

Surcharges

Transform(Matrix)

Transforme le rectangle en appliquant la matrice spécifiée.

Transform(Rect, Matrix)

Renvoie le rectangle qui résulte de l'application de la matrice spécifiée au rectangle spécifié.

Transform(Matrix)

Transforme le rectangle en appliquant la matrice spécifiée.

C#
public void Transform (System.Windows.Media.Matrix matrix);

Paramètres

matrix
Matrix

Une matrice qui spécifie la transformation à appliquer.

Exemples

L’exemple suivant montre comment utiliser la Transform(Matrix) méthode pour transformer une Rect structure à l’aide d’un Matrix.

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

S’applique à

.NET Framework 4.8 et autres versions
Produit Versions
.NET Framework 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
Windows Desktop 3.0, 3.1, 5, 6, 7

Transform(Rect, Matrix)

Renvoie le rectangle qui résulte de l'application de la matrice spécifiée au rectangle spécifié.

C#
public static System.Windows.Rect Transform (System.Windows.Rect rect, System.Windows.Media.Matrix matrix);

Paramètres

rect
Rect

Un rectangle qui est la base pour la transformation.

matrix
Matrix

Une matrice qui spécifie la transformation à appliquer.

Retours

Rect

Le rectangle qui résulte de l'opération.

Exemples

L’exemple suivant montre comment utiliser la Transform(Rect, Matrix) méthode pour créer une Rect structure qui résulte de l’application d’un Matrix rectangle existant.

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

S’applique à

.NET Framework 4.8 et autres versions
Produit Versions
.NET Framework 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
Windows Desktop 3.0, 3.1, 5, 6, 7