Rectangle.Union メソッド
アセンブリ: System.Drawing (system.drawing.dll 内)

Dim a As Rectangle Dim b As Rectangle Dim returnValue As Rectangle returnValue = Rectangle.Union(a, b)
戻り値
2 つの Rectangle 構造体の和集合を連結する Rectangle 構造体。

Union メソッドを使用する方法を次のコード例に示します。この例は、Windows フォームでの使用を意図してデザインされています。このコードをフォームに貼り付け、フォームの Paint イベントを処理するときに PaintEventArgs の e を渡して ShowRectangleUnion メソッドを呼び出します。
Private Sub ShowRectangleUnion(ByVal e As PaintEventArgs) ' Declare two rectangles and draw them. Dim rectangle1 As New Rectangle(30, 40, 50, 100) Dim rectangle2 As New Rectangle(50, 60, 100, 60) e.Graphics.DrawRectangle(Pens.Sienna, rectangle1) e.Graphics.DrawRectangle(Pens.BlueViolet, rectangle2) ' Declare a third rectangle as a union of the first two. Dim rectangle3 As Rectangle = Rectangle.Union(rectangle1, _ rectangle2) ' Fill in the third rectangle in a semi-transparent color. Dim transparentColor As Color = Color.FromArgb(40, 135, 135, 255) e.Graphics.FillRectangle(New SolidBrush(transparentColor), _ rectangle3) End Sub
private void ShowRectangleUnion(PaintEventArgs e) { // Declare two rectangles and draw them. Rectangle rectangle1 = new Rectangle(30, 40, 50, 100); Rectangle rectangle2 = new Rectangle(50, 60, 100, 60); e.Graphics.DrawRectangle(Pens.Sienna, rectangle1); e.Graphics.DrawRectangle(Pens.BlueViolet, rectangle2); // Declare a third rectangle as a union of the first two. Rectangle rectangle3 = Rectangle.Union(rectangle1, rectangle2); // Fill in the third rectangle in a semi-transparent color. Color transparentColor = Color.FromArgb(40, 135, 135, 255); e.Graphics.FillRectangle(new SolidBrush(transparentColor), rectangle3); }
private: void ShowRectangleUnion( PaintEventArgs^ e ) { // Declare two rectangles and draw them. Rectangle rectangle1 = Rectangle(30,40,50,100); Rectangle rectangle2 = Rectangle(50,60,100,60); e->Graphics->DrawRectangle( Pens::Sienna, rectangle1 ); e->Graphics->DrawRectangle( Pens::BlueViolet, rectangle2 ); // Declare a third rectangle as a union of the first two. Rectangle rectangle3 = Rectangle::Union( rectangle1, rectangle2 ); // Fill in the third rectangle in a semi-transparent color. Color transparentColor = Color::FromArgb( 40, 135, 135, 255 ); e->Graphics->FillRectangle( gcnew SolidBrush( transparentColor ), rectangle3 ); }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からRectangle.Union メソッドを検索する場合は、下記のリンクをクリックしてください。

- Rectangle.Union メソッドのページへのリンク