Share via


Region.Union 메서드

정의

지정된 Region와 통합되게 이 GraphicsPath을 업데이트합니다.

오버로드

Union(GraphicsPath)

지정된 Region와 통합되게 이 GraphicsPath을 업데이트합니다.

Union(Rectangle)

지정된 Region 구조체와 통합되게 이 Rectangle을 업데이트합니다.

Union(RectangleF)

지정된 Region 구조체와 통합되게 이 RectangleF을 업데이트합니다.

Union(Region)

지정된 Region와 통합되게 이 Region을 업데이트합니다.

Union(GraphicsPath)

Source:
Region.cs
Source:
Region.cs
Source:
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입니다.

예외

path이(가) null인 경우

예제

코드 예제는 및 Complement(GraphicsPath) 메서드를 Union(RectangleF) 참조하세요.

적용 대상

Union(Rectangle)

Source:
Region.cs
Source:
Region.cs
Source:
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)

Source:
Region.cs
Source:
Region.cs
Source:
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 Forms 사용하도록 설계되었으며 가 필요합니다PaintEventArgse. 코드는 다음 작업을 수행합니다.

  • 첫 번째 사각형을 만들고 검은색으로 화면에 그립니다.

  • 두 번째 사각형을 만들어 화면에 빨간색으로 그립니다.

  • 첫 번째 사각형을 사용하여 영역을 만듭니다.

  • complementRect결합된 경우 의 공용 구조체 myRegion 영역을 가져옵니다.

  • 은 공용 구조체 영역을 파란색으로 채우고 화면에 그립니다.

두 사각형은 겹치는 영역을 포함하여 파란색으로 채워집니다.

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)

Source:
Region.cs
Source:
Region.cs
Source:
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입니다.

예외

region이(가) null인 경우

예제

코드 예제는 및 Complement(GraphicsPath) 메서드를 Union(RectangleF) 참조하세요.

적용 대상