Rect.Union Metoda

Definice

Vytvoří obdélník, který je přesně velký, aby obsahoval daný obdélník a zadaný bod nebo druhý obdélník.

Přetížení

Union(Point)

Rozbalí aktuální obdélník přesně tak, aby obsahoval zadaný bod.

Union(Rect)

Rozbalí aktuální obdélník přesně tak, aby obsahoval zadaný obdélník.

Union(Rect, Point)

Vytvoří obdélník, který je přesně velký, aby zahrnoval zadaný obdélník a zadaný bod.

Union(Rect, Rect)

Vytvoří obdélník, který je přesně velký, aby obsahoval dva zadané obdélníky.

Union(Point)

Rozbalí aktuální obdélník přesně tak, aby obsahoval zadaný bod.

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

Parametry

point
Point

Bod, který chcete zahrnout.

Příklady

Následující příklad ukazuje, jak použít metodu Union(Point) k rozbalení aktuálního obdélníku přesně tak, aby obsahoval dané 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;
}

Viz také

Platí pro

Union(Rect)

Rozbalí aktuální obdélník přesně tak, aby obsahoval zadaný obdélník.

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

Parametry

rect
Rect

Obdélník, který chcete zahrnout.

Příklady

Následující příklad ukazuje, jak použít metodu Union(Rect) k rozbalení aktuálního obdélníku přesně tak, aby obsahoval zadaný obdélník.

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

Viz také

Platí pro

Union(Rect, Point)

Vytvoří obdélník, který je přesně velký, aby zahrnoval zadaný obdélník a zadaný bod.

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
Public Shared Function Union (rect As Rect, point As Point) As Rect

Parametry

rect
Rect

Obdélník, který chcete zahrnout.

point
Point

Bod, který chcete zahrnout.

Návraty

Rect

Obdélník, který je přesně velký, aby obsahoval zadaný obdélník a zadaný bod.

Příklady

Následující příklad ukazuje, jak použít metodu Union(Rect, Point) k vytvoření obdélníku, který je přesně velký, aby obsahoval daný obdélník a daný 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;
}

Viz také

Platí pro

Union(Rect, Rect)

Vytvoří obdélník, který je přesně velký, aby obsahoval dva zadané obdélníky.

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

Parametry

rect1
Rect

První obdélník, který se má zahrnout.

rect2
Rect

Druhý obdélník, který se má zahrnout.

Návraty

Rect

Výsledný obdélník.

Příklady

Následující příklad ukazuje, jak použít metodu Union(Rect, Rect) k vytvoření obdélníku, který je přesně velký, aby obsahoval dva dané obdélníky.

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

Viz také

Platí pro