Region.Intersect 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.
Sobrecargas
| Name | Description |
|---|---|
| Intersect(GraphicsPath) |
Atualiza isto Region para a interseção de si próprio com o especificado GraphicsPath. |
| Intersect(Rectangle) |
Atualiza isto Region para a interseção de si próprio com a estrutura especificada Rectangle . |
| Intersect(RectangleF) |
Atualiza isto Region para a interseção de si próprio com a estrutura especificada RectangleF . |
| Intersect(Region) |
Atualiza isto Region para a interseção de si próprio com o especificado Region. |
Intersect(GraphicsPath)
Atualiza isto Region para a interseção de si próprio com o especificado GraphicsPath.
public:
void Intersect(System::Drawing::Drawing2D::GraphicsPath ^ path);
public void Intersect(System.Drawing.Drawing2D.GraphicsPath path);
member this.Intersect : System.Drawing.Drawing2D.GraphicsPath -> unit
Public Sub Intersect (path As GraphicsPath)
Parâmetros
- path
- GraphicsPath
O GraphicsPath para intersectar com este Region.
Exemplos
Para exemplos de código, veja os RectangleF.Intersect(RectangleF) métodos e Complement(GraphicsPath) .
Aplica-se a
Intersect(Rectangle)
public:
void Intersect(System::Drawing::Rectangle rect);
public void Intersect(System.Drawing.Rectangle rect);
member this.Intersect : System.Drawing.Rectangle -> unit
Public Sub Intersect (rect As Rectangle)
Parâmetros
Exemplos
Para um exemplo de código, veja o Intersect(RectangleF) método.
Aplica-se a
Intersect(RectangleF)
Atualiza isto Region para a interseção de si próprio com a estrutura especificada RectangleF .
public:
void Intersect(System::Drawing::RectangleF rect);
public void Intersect(System.Drawing.RectangleF rect);
member this.Intersect : System.Drawing.RectangleF -> unit
Public Sub Intersect (rect As RectangleF)
Parâmetros
- rect
- RectangleF
A RectangleF estrutura para intersectar com este Region.
Exemplos
O seguinte exemplo de código foi concebido para uso com Windows Forms e requer PaintEventArgse, que é um parâmetro do tratador de eventos Paint. O código executa as seguintes ações:
Cria o primeiro retângulo e desenha-o para o ecrã a preto.
Cria o segundo retângulo e desenha-o para o ecrã em vermelho.
Cria uma região a partir do primeiro retângulo.
Obtém a área de interseção da região quando combinado com o segundo retângulo.
Preenche a área de interseção com azul e desenha-a para o ecrã.
Note que apenas a área sobreposta da região e do retângulo é azul.
public:
void Intersect_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 complementRect = RectangleF(90,30,100,100);
e->Graphics->DrawRectangle( Pens::Red, Rectangle::Round( complementRect ) );
// Create a region using the first rectangle.
System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect );
// Get the area of intersection for myRegion when combined with
// complementRect.
myRegion->Intersect( complementRect );
// Fill the intersection area of myRegion with blue.
SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue );
e->Graphics->FillRegion( myBrush, myRegion );
}
public void Intersect_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 complementRect = new RectangleF(90, 30, 100, 100);
e.Graphics.DrawRectangle(Pens.Red,
Rectangle.Round(complementRect));
// Create a region using the first rectangle.
Region myRegion = new Region(regionRect);
// Get the area of intersection for myRegion when combined with
// complementRect.
myRegion.Intersect(complementRect);
// Fill the intersection area of myRegion with blue.
SolidBrush myBrush = new SolidBrush(Color.Blue);
e.Graphics.FillRegion(myBrush, myRegion);
}
Public Sub Intersect_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 complementRect As New RectangleF(90, 30, 100, 100)
e.Graphics.DrawRectangle(Pens.Red, _
Rectangle.Round(complementRect))
' Create a region using the first rectangle.
Dim myRegion As New [Region](regionRect)
' Get the area of intersection for myRegion when combined with
' complementRect.
myRegion.Intersect(complementRect)
' 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
Intersect(Region)
public:
void Intersect(System::Drawing::Region ^ region);
public void Intersect(System.Drawing.Region region);
member this.Intersect : System.Drawing.Region -> unit
Public Sub Intersect (region As Region)
Parâmetros
Exemplos
Para exemplos de código, veja o Intersect(RectangleF) método e Complement(GraphicsPath).