Region.Union Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Met à jour cet objet Region avec l'union de celui-ci et du GraphicsPath spécifié.
Surcharges
Union(GraphicsPath) |
Met à jour cet objet Region avec l'union de celui-ci et du GraphicsPath spécifié. |
Union(Rectangle) |
Met à jour cet objet Region avec l'union de celui-ci et de la structure Rectangle spécifiée. |
Union(RectangleF) |
Met à jour cet objet Region avec l'union de celui-ci et de la structure RectangleF spécifiée. |
Union(Region) |
Met à jour cet objet Region avec l'union de celui-ci et du Region spécifié. |
Union(GraphicsPath)
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
Met à jour cet objet Region avec l'union de celui-ci et du GraphicsPath spécifié.
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)
Paramètres
- path
- GraphicsPath
GraphicsPath à unir avec cet objet Region.
Exceptions
path
a la valeur null
.
Exemples
Pour obtenir un exemple de code, consultez les Union(RectangleF) méthodes et Complement(GraphicsPath) .
S’applique à
Union(Rectangle)
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
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)
Paramètres
Exemples
Pour obtenir un exemple de code, consultez la Union(RectangleF) méthode .
S’applique à
Union(RectangleF)
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
Met à jour cet objet Region avec l'union de celui-ci et de la structure RectangleF spécifiée.
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)
Paramètres
- rect
- RectangleF
Structure RectangleF à unir avec cet objet Region.
Exemples
L’exemple de code suivant est conçu pour être utilisé avec Windows Forms et nécessite PaintEventArgse
. Le code effectue les actions suivantes :
Crée le premier rectangle et le dessine à l’écran en noir.
Crée un deuxième rectangle et le dessine vers l’écran en rouge.
Crée une région à l’aide du premier rectangle.
Obtient la zone d’union pour lorsqu’il
myRegion
est combiné aveccomplementRect
.Remplit la zone d’union de bleu et le dessine à l’écran.
Notez que les deux rectangles sont remplis de bleu, y compris la zone de chevauchement.
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
S’applique à
Union(Region)
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
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)
Paramètres
Exceptions
region
a la valeur null
.
Exemples
Pour obtenir un exemple de code, consultez la Union(RectangleF) méthode et Complement(GraphicsPath) .
S’applique à
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour