Udostępnij przez


Region.Union Metoda

Definicja

Aktualizacje to Region do samego związku i określonego GraphicsPath.

Przeciążenia

Union(GraphicsPath)

Aktualizacje to Region do samego związku i określonego GraphicsPath.

Union(Rectangle)

Aktualizacje to Region do samej unii i określonej Rectangle struktury.

Union(RectangleF)

Aktualizacje to Region do samej unii i określonej RectangleF struktury.

Union(Region)

Aktualizacje to Region do samego związku i określonego Region.

Union(GraphicsPath)

Źródło:
Region.cs
Źródło:
Region.cs
Źródło:
Region.cs

Aktualizacje to Region do samego związku i określonego 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)

Parametry

path
GraphicsPath

Element GraphicsPath do zjednoczenia z tym Regionelementem .

Wyjątki

path to null.

Przykłady

Aby zapoznać się z przykładem kodu, zobacz Union(RectangleF) metody i Complement(GraphicsPath) .

Dotyczy

Union(Rectangle)

Źródło:
Region.cs
Źródło:
Region.cs
Źródło:
Region.cs

Aktualizacje to Region do samej unii i określonej Rectangle struktury.

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)

Parametry

rect
Rectangle

Struktura do zjednoczenia Rectangle z tym Regionelementem .

Przykłady

Aby zapoznać się z przykładem kodu, zobacz metodę Union(RectangleF) .

Dotyczy

Union(RectangleF)

Źródło:
Region.cs
Źródło:
Region.cs
Źródło:
Region.cs

Aktualizacje to Region do samej unii i określonej RectangleF struktury.

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)

Parametry

rect
RectangleF

Struktura do zjednoczenia RectangleF z tym Regionelementem .

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgse. Kod wykonuje następujące akcje:

  • Tworzy pierwszy prostokąt i rysuje go na ekranie w kolorze czarnym.

  • Tworzy drugi prostokąt i rysuje go na ekranie na czerwono.

  • Tworzy region przy użyciu pierwszego prostokąta.

  • Pobiera obszar unii dla myRegion w połączeniu z complementRect.

  • Wypełnia obszar unii niebieskim i rysuje go na ekranie.

Zwróć uwagę, że oba prostokąty są wypełnione niebieskim, w tym obszarem nakładania się.

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

Dotyczy

Union(Region)

Źródło:
Region.cs
Źródło:
Region.cs
Źródło:
Region.cs

Aktualizacje to Region do samego związku i określonego 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)

Parametry

region
Region

Element Region do zjednoczenia z tym Regionelementem .

Wyjątki

region to null.

Przykłady

Aby zapoznać się z przykładem kodu, zobacz metodę Union(RectangleF) and Complement(GraphicsPath) .

Dotyczy