Share via


Region.Union Metoda

Definice

Aktualizace to Region sjednocení sebe sama a zadaného GraphicsPath.

Přetížení

Union(GraphicsPath)

Aktualizace to Region sjednocení sebe sama a zadaného GraphicsPath.

Union(Rectangle)

Aktualizace sjednocení Region sebe sama a zadané Rectangle struktury.

Union(RectangleF)

Aktualizace sjednocení Region sebe sama a zadané RectangleF struktury.

Union(Region)

Aktualizace to Region sjednocení sebe sama a zadaného Region.

Union(GraphicsPath)

Zdroj:
Region.cs
Zdroj:
Region.cs
Zdroj:
Region.cs

Aktualizace to Region sjednocení sebe sama a zadaného 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

Chcete-li GraphicsPath spojit s tímto Region.

Výjimky

path je null.

Příklady

Příklad kódu najdete v Union(RectangleF) tématu metody a Complement(GraphicsPath) .

Platí pro

Union(Rectangle)

Zdroj:
Region.cs
Zdroj:
Region.cs
Zdroj:
Region.cs

Aktualizace sjednocení Region sebe sama a zadané 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 Rectangle , která se má spojit s tímto Regionobjektem .

Příklady

Příklad kódu najdete v Union(RectangleF) metodě .

Platí pro

Union(RectangleF)

Zdroj:
Region.cs
Zdroj:
Region.cs
Zdroj:
Region.cs

Aktualizace sjednocení Region sebe sama a zadané 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 RectangleF , která se má spojit s tímto Regionobjektem .

Příklady

Následující příklad kódu je navržený pro použití s model Windows Forms a vyžaduje PaintEventArgse. Kód provede následující akce:

  • Vytvoří první obdélník a nakreslí ho na obrazovku černě.

  • Vytvoří druhý obdélník a nakreslí ho na obrazovku červeně.

  • Vytvoří oblast pomocí prvního obdélníku.

  • Získá oblast sjednocení pro v myRegion kombinaci s complementRect.

  • Vyplní oblast sjednocení modrou a vykreslí ji na obrazovku.

Všimněte si, že oba obdélníky jsou vyplněné modrou, včetně oblasti překrytí.

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

Platí pro

Union(Region)

Zdroj:
Region.cs
Zdroj:
Region.cs
Zdroj:
Region.cs

Aktualizace to Region sjednocení sebe sama a zadaného 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

Chcete-li Region spojit s tímto Region.

Výjimky

region je null.

Příklady

Příklad kódu najdete v Union(RectangleF) metodě a Complement(GraphicsPath) .

Platí pro