Region.Union Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Atualiza isto Region para a união entre si e o especificado GraphicsPath.
Sobrecargas
| Name | Description |
|---|---|
| Union(GraphicsPath) |
Atualiza isto Region para a união entre si e o especificado GraphicsPath. |
| Union(Rectangle) |
Atualiza isto Region para a união entre si e a estrutura especificada Rectangle . |
| Union(RectangleF) |
Atualiza isto Region para a união entre si e a estrutura especificada RectangleF . |
| Union(Region) |
Atualiza isto Region para a união entre si e o especificado Region. |
Union(GraphicsPath)
Atualiza isto Region para a união entre si e o especificado 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)
Parâmetros
- path
- GraphicsPath
O GraphicsPath para se unir a isto Region.
Exceções
path é null.
Exemplos
Para um exemplo de código, veja os Union(RectangleF) métodos e Complement(GraphicsPath) .
Aplica-se a
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)
Parâmetros
Exemplos
Para um exemplo de código, veja o Union(RectangleF) método.
Aplica-se a
Union(RectangleF)
Atualiza isto Region para a união entre si e a estrutura especificada 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)
Parâmetros
- rect
- RectangleF
A RectangleF estrutura para se unir a este Region.
Exemplos
O exemplo de código seguinte foi concebido para uso com Windows Forms e requer PaintEventArgse. O código executa as seguintes ações:
Cria o primeiro retângulo e desenha-o para o ecrã a preto.
Cria um segundo retângulo e desenha-o para o ecrã em vermelho.
Cria uma região usando o primeiro retângulo.
Obtém a área de união para
myRegionquando combinada comcomplementRect.Preenche a área de união com azul e desenha-a para o ecrã.
Note que ambos os retângulos estão preenchidos com azul, incluindo a área de sobreposição.
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
Aplica-se a
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)
Parâmetros
Exceções
region é null.
Exemplos
Para um exemplo de código, veja o Union(RectangleF) método e Complement(GraphicsPath) .