Region.Union メソッド

定義

この Region を、それ自体と指定の GraphicsPath の和集合に更新します。

オーバーロード

Union(GraphicsPath)

この Region を、それ自体と指定の GraphicsPath の和集合に更新します。

Union(Rectangle)

この Region を、それ自体と指定の Rectangle 構造体の和集合に更新します。

Union(RectangleF)

この Region を、それ自体と指定の RectangleF 構造体の和集合に更新します。

Union(Region)

この Region を、それ自体と指定の Region の和集合に更新します。

Union(GraphicsPath)

ソース:
Region.cs
ソース:
Region.cs
ソース:
Region.cs

この Region を、それ自体と指定の GraphicsPath の和集合に更新します。

public:
 void Union(System::Drawing::Drawing2D::GraphicsPath ^ path);
public void Union (System.Drawing.Drawing2D.GraphicsPath path);
member this.Union : System.Drawing.Drawing2D.GraphicsPath -> unit
Public Sub Union (path As GraphicsPath)

パラメーター

path
GraphicsPath

この GraphicsPath と結合する Region

例外

pathnullです。

コード例については、 メソッドと Complement(GraphicsPath) メソッドをUnion(RectangleF)参照してください。

適用対象

Union(Rectangle)

ソース:
Region.cs
ソース:
Region.cs
ソース:
Region.cs

この Region を、それ自体と指定の Rectangle 構造体の和集合に更新します。

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

パラメーター

rect
Rectangle

この Rectangle と結合する Region 構造体。

コード例については、 メソッドを Union(RectangleF) 参照してください。

適用対象

Union(RectangleF)

ソース:
Region.cs
ソース:
Region.cs
ソース:
Region.cs

この Region を、それ自体と指定の RectangleF 構造体の和集合に更新します。

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

パラメーター

rect
RectangleF

この RectangleF と結合する Region 構造体。

次のコード例は、Windows フォームで使用するように設計されており、 が必要PaintEventArgseです。 コードは、次のアクションを実行します。

  • 最初の四角形を作成し、黒で画面に描画します。

  • 2 番目の四角形を作成し、赤で画面に描画します。

  • 最初の四角形を使用して領域を作成します。

  • と組み合わせた場合の の myRegion 共用体の領域を complementRect取得します。

  • 和集合の領域を青で塗りつぶし、画面に描画します。

両方の四角形が、重なり合う領域を含む青で塗りつぶされていることに注意してください。

void Union_RectF_Example( PaintEventArgs^ e )
{
   // Create the first rectangle and draw it to the screen in black.
   Rectangle regionRect = Rectangle(20,20,100,100);
   e->Graphics->DrawRectangle( Pens::Black, regionRect );

   // create the second rectangle and draw it to the screen in red.
   RectangleF unionRect = RectangleF(90,30,100,100);
   e->Graphics->DrawRectangle( Pens::Red, Rectangle::Round( unionRect ) );

   // Create a region using the first rectangle.
   System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect );

   // Get the area of union for myRegion when combined with
   // complementRect.
   myRegion->Union( unionRect );

   // Fill the union area of myRegion with blue.
   SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue );
   e->Graphics->FillRegion( myBrush, myRegion );
}
public void Union_RectF_Example(PaintEventArgs e)
{
             
    // Create the first rectangle and draw it to the screen in black.
    Rectangle regionRect = new Rectangle(20, 20, 100, 100);
    e.Graphics.DrawRectangle(Pens.Black, regionRect);
             
    // create the second rectangle and draw it to the screen in red.
    RectangleF unionRect = new RectangleF(90, 30, 100, 100);
    e.Graphics.DrawRectangle(Pens.Red,
        Rectangle.Round(unionRect));
             
    // Create a region using the first rectangle.
    Region myRegion = new Region(regionRect);
             
    // Get the area of union for myRegion when combined with
             
    // complementRect.
    myRegion.Union(unionRect);
             
    // Fill the union area of myRegion with blue.
    SolidBrush myBrush = new SolidBrush(Color.Blue);
    e.Graphics.FillRegion(myBrush, myRegion);
}
Public Sub Union_RectF_Example(ByVal e As PaintEventArgs)

    ' Create the first rectangle and draw it to the screen in black.
    Dim regionRect As New Rectangle(20, 20, 100, 100)
    e.Graphics.DrawRectangle(Pens.Black, regionRect)

    ' create the second rectangle and draw it to the screen in red.
    Dim unionRect As New RectangleF(90, 30, 100, 100)
    e.Graphics.DrawRectangle(Pens.Red, Rectangle.Round(unionRect))

    ' Create a region using the first rectangle.
    Dim myRegion As New [Region](regionRect)

    ' Get the area of union for myRegion when combined with
    ' complementRect.
    myRegion.Union(unionRect)

    ' Fill the intersection area of myRegion with blue.
    Dim myBrush As New SolidBrush(Color.Blue)
    e.Graphics.FillRegion(myBrush, myRegion)
End Sub

適用対象

Union(Region)

ソース:
Region.cs
ソース:
Region.cs
ソース:
Region.cs

この Region を、それ自体と指定の Region の和集合に更新します。

public:
 void Union(System::Drawing::Region ^ region);
public void Union (System.Drawing.Region region);
member this.Union : System.Drawing.Region -> unit
Public Sub Union (region As Region)

パラメーター

region
Region

この Region と結合する Region

例外

regionnullです。

コード例については、 メソッドと Complement(GraphicsPath) メソッドをUnion(RectangleF)参照してください。

適用対象