Region.Union Metodo

Definizione

Aggiorna questa classe Region all'unione della stessa con la classe GraphicsPath specificata.

Overload

Union(GraphicsPath)

Aggiorna questa classe Region all'unione della stessa con la classe GraphicsPath specificata.

Union(Rectangle)

Aggiorna questa classe Region all'unione della stessa con la struttura Rectangle.

Union(RectangleF)

Aggiorna questa classe Region all'unione della stessa con la struttura RectangleF.

Union(Region)

Aggiorna questa classe Region all'unione della stessa con la classe Region specificata.

Union(GraphicsPath)

Origine:
Region.cs
Origine:
Region.cs
Origine:
Region.cs

Aggiorna questa classe Region all'unione della stessa con la classe GraphicsPath specificata.

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)

Parametri

path
GraphicsPath

Classe GraphicsPath da unire a questa classe Region.

Eccezioni

path è null.

Esempio

Per un esempio di codice, vedere i Union(RectangleF) metodi e Complement(GraphicsPath) .

Si applica a

Union(Rectangle)

Origine:
Region.cs
Origine:
Region.cs
Origine:
Region.cs

Aggiorna questa classe Region all'unione della stessa con la struttura 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)

Parametri

rect
Rectangle

Struttura Rectangle da unire a questa classe Region.

Esempio

Per un esempio di codice, vedere il Union(RectangleF) metodo .

Si applica a

Union(RectangleF)

Origine:
Region.cs
Origine:
Region.cs
Origine:
Region.cs

Aggiorna questa classe Region all'unione della stessa con la struttura 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)

Parametri

rect
RectangleF

Struttura RectangleF da unire a questa classe Region.

Esempio

L'esempio di codice seguente è progettato per l'uso con Windows Forms e richiede PaintEventArgse. Il codice esegue le azioni seguenti:

  • Crea il primo rettangolo e lo disegna sullo schermo in nero.

  • Crea un secondo rettangolo e lo disegna sullo schermo in rosso.

  • Crea un'area usando il primo rettangolo.

  • Ottiene l'area di unione per myRegion quando viene combinata con complementRect.

  • Riempie l'area dell'unione con blu e la disegna sullo schermo.

Si noti che entrambi i rettangoli sono riempiti con blu, inclusa l'area di sovrapposizione.

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

Si applica a

Union(Region)

Origine:
Region.cs
Origine:
Region.cs
Origine:
Region.cs

Aggiorna questa classe Region all'unione della stessa con la classe Region specificata.

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)

Parametri

region
Region

Classe Region da unire a questa classe Region.

Eccezioni

region è null.

Esempio

Per un esempio di codice, vedere il Union(RectangleF) metodo e Complement(GraphicsPath) .

Si applica a