Rect.Union 메서드

정의

지정된 사각형과 지정된 지점 또는 두 번째 사각형을 정확히 포함할 수 있는 크기의 사각형을 만듭니다.

오버로드

Union(Point)

지정된 지점을 정확히 포함할 수 있는 크기로 현재 사각형을 확장합니다.

Union(Rect)

지정된 사각형을 정확히 포함할 수 있는 크기로 현재 사각형을 확장합니다.

Union(Rect, Point)

지정된 사각형과 지정된 지점을 정확히 포함할 수 있는 크기의 사각형을 만듭니다.

Union(Rect, Rect)

지정된 두 사각형을 정확히 포함할 수 있는 크기의 사각형을 만듭니다.

Union(Point)

지정된 지점을 정확히 포함할 수 있는 크기로 현재 사각형을 확장합니다.

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)

매개 변수

point
Point

포함할 지점입니다.

예제

다음 예제에서는 사용 하는 방법을 보여 줍니다 합니다 Union(Point) 메서드를 포함 하도록 현재 사각형을 정확히 확장을 지정 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;
}

추가 정보

적용 대상

Union(Rect)

지정된 사각형을 정확히 포함할 수 있는 크기로 현재 사각형을 확장합니다.

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)

매개 변수

rect
Rect

포함할 사각형입니다.

예제

다음 예제에서는 사용 하는 방법의 Union(Rect) 확장 현재 사각형을 정확히 지정된 된 사각형을 포함 하는 방법입니다.

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

추가 정보

적용 대상

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

매개 변수

rect
Rect

포함할 사각형입니다.

point
Point

포함할 지점입니다.

반환

Rect

지정된 사각형과 지정된 지점을 정확히 포함할 수 있는 크기의 사각형입니다.

예제

다음 예제에서는 사용 하는 방법을 보여 줍니다 합니다 Union(Rect, Point) 메서드는 지정 된 사각형을 포함 하는 데 있는 큰 사각형을 만듭니다 및 지정 된 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;
}

추가 정보

적용 대상

Union(Rect, Rect)

지정된 두 사각형을 정확히 포함할 수 있는 크기의 사각형을 만듭니다.

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

매개 변수

rect1
Rect

포함할 첫 번째 사각형입니다.

rect2
Rect

포함할 두 번째 사각형입니다.

반환

Rect

결과 사각형입니다.

예제

다음 예제에서는 사용 하는 방법의 Union(Rect, Rect) 메서드는 지정 된 두 사각형을 포함 하는 데 있는 큰 사각형을 만듭니다.

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

추가 정보

적용 대상