Region.Union Método
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Actualiza esta Region a la unión de sí misma y al GraphicsPathespecificado.
Sobrecargas
| Union(GraphicsPath) |
Actualiza esta Region a la unión de sí misma y al GraphicsPathespecificado. |
| Union(Rectangle) |
Actualiza esta Region a la unión de sí misma y a la estructura de Rectangle especificada. |
| Union(RectangleF) |
Actualiza esta Region a la unión de sí misma y a la estructura de RectangleF especificada. |
| Union(Region) |
Actualiza esta Region a la unión de sí misma y al Regionespecificado. |
Union(GraphicsPath)
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
Actualiza esta Region a la unión de sí misma y al GraphicsPathespecificado.
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)
Parámetros
- path
- GraphicsPath
El GraphicsPath unir con este Region.
Excepciones
path es null.
Ejemplos
Para obtener un ejemplo de código, consulte los métodos Union(RectangleF) y Complement(GraphicsPath).
Se aplica a
Union(Rectangle)
- Source:
- Region.cs
- Source:
- Region.cs
- 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)
Parámetros
Ejemplos
Para obtener un ejemplo de código, consulte el método Union(RectangleF).
Se aplica a
Union(RectangleF)
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
Actualiza esta Region a la unión de sí misma y a la estructura de RectangleF especificada.
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)
Parámetros
- rect
- RectangleF
Estructura RectangleF que se va a unir con este Region.
Ejemplos
El ejemplo de código siguiente está diseñado para su uso con Windows Forms y requiere PaintEventArgse. El código realiza las siguientes acciones:
Crea el primer rectángulo y lo dibuja en la pantalla en negro.
Crea un segundo rectángulo y lo dibuja en la pantalla en rojo.
Crea una región con el primer rectángulo.
Obtiene el área de unión de
myRegioncuando se combina concomplementRect.Rellena el área de unión con azul y la dibuja en la pantalla.
Observe que ambos rectángulos se rellenan con azul, incluido el área de superposición.
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
Se aplica a
Union(Region)
- Source:
- Region.cs
- Source:
- Region.cs
- 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)
Parámetros
Excepciones
region es null.
Ejemplos
Para obtener un ejemplo de código, consulte el método Union(RectangleF) y Complement(GraphicsPath).