Rect.Union Rect.Union Rect.Union Rect.Union Method

Definizione

Crea un rettangolo abbastanza grande per poter contenere un rettangolo specificato ed un punto specificato o un secondo rettangolo.Creates a rectangle that is exactly large enough to contain a given rectangle and a specified point or second rectangle.

Overload

Union(Point) Union(Point) Union(Point)

Espande il rettangolo corrente abbastanza da poter contenere il punto specificato.Expands the current rectangle exactly enough to contain the specified point.

Union(Rect) Union(Rect) Union(Rect)

Espande il rettangolo corrente abbastanza per contenere il rettangolo specificato.Expands the current rectangle exactly enough to contain the specified rectangle.

Union(Rect, Point) Union(Rect, Point) Union(Rect, Point)

Crea un rettangolo grande abbastanza da poter includere il rettangolo specificato ed il punto specificato.Creates a rectangle that is exactly large enough to include the specified rectangle and the specified point.

Union(Rect, Rect) Union(Rect, Rect) Union(Rect, Rect) Union(Rect, Rect)

Crea un rettangolo grande abbastanza da poter contenere i due rettangoli specificati.Creates a rectangle that is exactly large enough to contain the two specified rectangles.

Union(Point) Union(Point) Union(Point)

Espande il rettangolo corrente abbastanza da poter contenere il punto specificato.Expands the current rectangle exactly enough to contain the specified point.

public:
 void Union(System::Windows::Point point);
public void Union (System.Windows.Point point);
member this.Union : System.Windows.Point -> unit

Parametri

point
Point Point Point Point

Punto da includere.The point to include.

Esempi

Nell'esempio seguente viene illustrato come utilizzare il Union(Point) metodo per espandere esattamente il rettangolo corrente per contenere un oggetto specificato Point.The following example shows how to use the Union(Point) method to expand the current rectangle exactly enough to contain a given Point.

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;

}
Vedi anche

Union(Rect) Union(Rect) Union(Rect)

Espande il rettangolo corrente abbastanza per contenere il rettangolo specificato.Expands the current rectangle exactly enough to contain the specified rectangle.

public:
 void Union(System::Windows::Rect rect);
public void Union (System.Windows.Rect rect);
member this.Union : System.Windows.Rect -> unit

Parametri

rect
Rect Rect Rect Rect

Rettangolo da includere.The rectangle to include.

Esempi

Nell'esempio seguente viene illustrato come utilizzare il Union(Rect) metodo per espandere il rettangolo corrente abbastanza esattamente da contenere il rettangolo specificato.The following example shows how to use the Union(Rect) method to expand the current rectangle exactly enough to contain the specified rectangle.

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;

}
Vedi anche

Union(Rect, Point) Union(Rect, Point) Union(Rect, Point)

Crea un rettangolo grande abbastanza da poter includere il rettangolo specificato ed il punto specificato.Creates a rectangle that is exactly large enough to include the specified rectangle and the specified point.

public:
 static System::Windows::Rect Union(System::Windows::Rect rect, System::Windows::Point point);
public static System.Windows.Rect Union (System.Windows.Rect rect, System.Windows.Point point);
static member Union : System.Windows.Rect * System.Windows.Point -> System.Windows.Rect

Parametri

rect
Rect Rect Rect Rect

Rettangolo da includere.The rectangle to include.

point
Point Point Point Point

Punto da includere.The point to include.

Restituisce

Rettangolo grande abbastanza da poter contenere il rettangolo specificato ed il punto specificato.A rectangle that is exactly large enough to contain the specified rectangle and the specified point.

Esempi

Nell'esempio seguente viene illustrato come utilizzare il Union(Rect, Point) metodo per creare un rettangolo sufficientemente grande da contenere un rettangolo specificato e un oggetto specificato. PointThe following example shows how to use the Union(Rect, Point) method to create a rectangle that is exactly large enough to contain a given rectangle and a given Point.

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;

}
Vedi anche

Union(Rect, Rect) Union(Rect, Rect) Union(Rect, Rect) Union(Rect, Rect)

Crea un rettangolo grande abbastanza da poter contenere i due rettangoli specificati.Creates a rectangle that is exactly large enough to contain the two specified rectangles.

public:
 static System::Windows::Rect Union(System::Windows::Rect rect1, System::Windows::Rect rect2);
public static System.Windows.Rect Union (System.Windows.Rect rect1, System.Windows.Rect rect2);
static member Union : System.Windows.Rect * System.Windows.Rect -> System.Windows.Rect
Public Shared Function Union (rect1 As Rect, rect2 As Rect) As Rect

Parametri

rect1
Rect Rect Rect Rect

Il primo rettangolo da includere.The first rectangle to include.

rect2
Rect Rect Rect Rect

Secondo rettangolo da includere.The second rectangle to include.

Restituisce

Rettangolo risultante.The resulting rectangle.

Esempi

Nell'esempio seguente viene illustrato come utilizzare il Union(Rect, Rect) metodo per creare un rettangolo sufficientemente grande da contenere due rettangoli specificati.The following example shows how to use the Union(Rect, Rect) method to create a rectangle that is exactly large enough to contain two given rectangles.

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;

}
Vedi anche

Si applica a