Rect.Union メソッド

定義

指定した四角形と指定したポイントまたは 2 番目の四角形を格納するのに十分な大きさの四角形を作成します。

オーバーロード

名前 説明
Union(Point)

現在の四角形を、指定したポイントを格納するのに十分な量だけ展開します。

Union(Rect)

現在の四角形を、指定した四角形を格納するのに十分な量だけ展開します。

Union(Rect, Point)

指定した四角形と指定したポイントを含めるのに十分な大きさの四角形を作成します。

Union(Rect, Rect)

指定した 2 つの四角形を格納するのに十分な大きさの四角形を作成します。

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

含めるポイント。

返品

指定した四角形と指定したポイントを格納するのに十分な大きさの四角形。

次の例は、 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)

指定した 2 つの四角形を格納するのに十分な大きさの四角形を作成します。

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

含める 2 番目の四角形。

返品

結果の四角形。

次の例は、 Union(Rect, Rect) メソッドを使用して、指定された 2 つの四角形を格納するのに十分な大きさの四角形を作成する方法を示しています。

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

こちらもご覧ください

適用対象