Lire en anglais

Partager via


Rect.Union Méthode

Définition

Crée un rectangle qui est exactement assez grand pour contenir un rectangle donné et un point spécifié ou un deuxième rectangle.

Surcharges

Union(Point)

Développe le rectangle actuel exactement assez pour contenir le point spécifié.

Union(Rect)

Développe le rectangle actuel exactement assez pour contenir le rectangle spécifié.

Union(Rect, Point)

Crée un rectangle qui est exactement assez grand pour inclure le rectangle et le point spécifiés.

Union(Rect, Rect)

Crée un rectangle qui est exactement assez grand pour contenir les deux rectangles spécifiés.

Union(Point)

Développe le rectangle actuel exactement assez pour contenir le point spécifié.

C#
public void Union (System.Windows.Point point);

Paramètres

point
Point

Le point à inclure.

Exemples

L’exemple suivant montre comment utiliser la méthode pour développer le Union(Point) rectangle actuel exactement suffisamment pour contenir un donné Point.

C#
private Rect unionExample1()
{
    // Initialize new rectangle.
    Rect myRectangle = new Rect();

    // The Location property specifies the coordinates of the upper left-hand 
    // corner of the rectangle. 
    myRectangle.Location = new Point(10, 5);

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

    // The Union method expands the current rectangle exactly enough to contain 
    // the specified point. myRectangle expands to a location of 0,0 and a size
    // of 210,55.
    myRectangle.Union(new Point(0,0));

    // Returns 0,0,210,55
    return myRectangle;
}

Voir aussi

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

Union(Rect)

Développe le rectangle actuel exactement assez pour contenir le rectangle spécifié.

C#
public void Union (System.Windows.Rect rect);

Paramètres

rect
Rect

Le rectangle à inclure.

Exemples

L’exemple suivant montre comment utiliser la méthode pour développer le Union(Rect) rectangle actuel exactement suffisamment pour contenir le rectangle spécifié.

C#
private Rect unionExample2()
{
    // Initialize new rectangle.
    Rect myRectangle = new Rect();

    // The Location property specifies the coordinates of the upper left-hand 
    // corner of the rectangle. 
    myRectangle.Location = new Point(10, 5);

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

    // Create second rectangle.
    Rect myRectangle2 = new Rect();
    myRectangle2.Location = new Point(0, 0);
    myRectangle2.Size = new Size(200, 50);

    // The Union method expands the current rectangle exactly enough to contain 
    // the specified rectangle. myRectangle expands to a location of 0,0 and a size
    // of 210,55.
    myRectangle.Union(myRectangle2);

    // Returns 0,0,210,55
    return myRectangle;
}

Voir aussi

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

Union(Rect, Point)

Crée un rectangle qui est exactement assez grand pour inclure le rectangle et le point spécifiés.

C#
public static System.Windows.Rect Union (System.Windows.Rect rect, System.Windows.Point point);

Paramètres

rect
Rect

Le rectangle à inclure.

point
Point

Le point à inclure.

Retours

Rect

Un rectangle qui est exactement assez grand pour contenir le rectangle et le point spécifiés.

Exemples

L’exemple suivant montre comment utiliser la Union(Rect, Point) méthode pour créer un rectangle qui est exactement assez grand pour contenir un rectangle donné et un rectangle donné Point.

C#
private Rect unionExample3()
{
    // Initialize new rectangle.
    Rect myRectangle = new Rect();

    // The Location property specifies the coordinates of the upper left-hand 
    // corner of the rectangle. 
    myRectangle.Location = new Point(10, 5);

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

    // Create second rectangle.
    Rect myRectangle2 = new Rect();
    myRectangle2.Location = new Point(0, 0);
    myRectangle2.Size = new Size(200, 50);

    // The Union method expands the current rectangle exactly enough to contain 
    // the specified rectangle and the specified Point. In this example, returnRect 
    // expands to a location of 0,0 and a size of 250,60.
    Rect returnRect = Rect.Union(myRectangle2, new Point(250,60));

    // Returns 0,0,250,60
    return returnRect;
}

Voir aussi

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

Union(Rect, Rect)

Crée un rectangle qui est exactement assez grand pour contenir les deux rectangles spécifiés.

C#
public static System.Windows.Rect Union (System.Windows.Rect rect1, System.Windows.Rect rect2);

Paramètres

rect1
Rect

Le premier rectangle à inclure.

rect2
Rect

Le deuxième rectangle à inclure.

Retours

Rect

Le rectangle résultant.

Exemples

L’exemple suivant montre comment utiliser la Union(Rect, Rect) méthode pour créer un rectangle qui est exactement suffisamment grand pour contenir deux rectangles donnés.

C#
private Rect unionExample4()
{
    // Initialize new rectangle.
    Rect myRectangle = new Rect();

    // The Location property specifies the coordinates of the upper left-hand 
    // corner of the rectangle. 
    myRectangle.Location = new Point(10, 5);

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

    // Create second rectangle.
    Rect myRectangle2 = new Rect();
    myRectangle2.Location = new Point(0, 0);
    myRectangle2.Size = new Size(200, 50);

    // Create a third rectangle.
    Rect myRectangle3 = new Rect();
    myRectangle3.Location = new Point(210, 60);
    myRectangle3.Size = new Size(50, 50);

    // The Union method expands the current rectangle exactly enough to contain 
    // the two specified rectangles. In this example, returnRect expands to 
    // a location of 0,0 and a size of 260,110.
    Rect returnRect = Rect.Union(myRectangle2, myRectangle3);

    // Returns 0,0,260,110
    return returnRect;
}

Voir aussi

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