Region.Union Methode
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Werkt dit Region bij aan de samenvoeging van zichzelf en de opgegeven GraphicsPath.
Overloads
| Name | Description |
|---|---|
| Union(GraphicsPath) |
Werkt dit Region bij aan de samenvoeging van zichzelf en de opgegeven GraphicsPath. |
| Union(Rectangle) |
Werkt dit Region bij aan de samenvoeging van zichzelf en de opgegeven Rectangle structuur. |
| Union(RectangleF) |
Werkt dit Region bij aan de samenvoeging van zichzelf en de opgegeven RectangleF structuur. |
| Union(Region) |
Werkt dit Region bij aan de samenvoeging van zichzelf en de opgegeven Region. |
Union(GraphicsPath)
Werkt dit Region bij aan de samenvoeging van zichzelf en de opgegeven 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)
Parameters
- path
- GraphicsPath
De GraphicsPath te verenigen met dit Region.
Uitzonderingen
path is null.
Voorbeelden
Zie de Union(RectangleF) en Complement(GraphicsPath) methoden voor een codevoorbeeld.
Van toepassing op
Union(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)
Parameters
Voorbeelden
Zie de Union(RectangleF) methode voor een codevoorbeeld.
Van toepassing op
Union(RectangleF)
Werkt dit Region bij aan de samenvoeging van zichzelf en de opgegeven RectangleF structuur.
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)
Parameters
- rect
- RectangleF
De RectangleF structuur die met dit Regionmoet worden verenigd.
Voorbeelden
Het volgende codevoorbeeld is ontworpen voor gebruik met Windows Forms en vereist PaintEventArgse. De code voert de volgende acties uit:
Hiermee maakt u de eerste rechthoek en tekent u deze op het scherm in zwart.
Hiermee maakt u een tweede rechthoek en tekent u deze in het rood op het scherm.
Hiermee maakt u een regio met behulp van de eerste rechthoek.
Hiermee wordt het gebied van samenvoeging voor
myRegionwanneer gecombineerd metcomplementRect.Hiermee vult u het gebied van de samenvoeging met blauw en tekent u het op het scherm.
U ziet dat beide rechthoeken blauw zijn, inclusief het overlapgebied.
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
Van toepassing op
Union(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)
Parameters
Uitzonderingen
region is null.
Voorbeelden
Zie de Union(RectangleF) en Complement(GraphicsPath) methode voor een codevoorbeeld.