Region.Intersect Método
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Sobrecargas
| Nome | Description |
|---|---|
| Intersect(GraphicsPath) |
Atualiza isso Region para a interseção de si mesmo com o especificado GraphicsPath. |
| Intersect(Rectangle) |
Atualiza isso Region para a interseção de si mesmo com a estrutura especificada Rectangle . |
| Intersect(RectangleF) |
Atualiza isso Region para a interseção de si mesmo com a estrutura especificada RectangleF . |
| Intersect(Region) |
Atualiza isso Region para a interseção de si mesmo com o especificado Region. |
Intersect(GraphicsPath)
Atualiza isso Region para a interseção de si mesmo 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
A GraphicsPath interseção com isso Region.
Exemplos
Para obter exemplos de código, consulte os métodos e Complement(GraphicsPath) os RectangleF.Intersect(RectangleF) métodos.
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 obter um exemplo de código, consulte o Intersect(RectangleF) método.
Aplica-se a
Intersect(RectangleF)
Atualiza isso Region para a interseção de si mesmo 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 a ser intersecciona com esta Region.
Exemplos
O exemplo de código a seguir foi projetado para uso com Windows Forms e requer PaintEventArgse, que é um parâmetro do manipulador de eventos Paint. O código executa as seguintes ações:
Cria o primeiro retângulo e o desenha para a tela em preto.
Cria o segundo retângulo e o desenha para a tela em vermelho.
Cria uma região do primeiro retângulo.
Obtém a área de interseção para a região quando combinada com o segundo retângulo.
Preenche a área de interseção com azul e a desenha para a tela.
Observe que apenas a área sobreposta para a região e o 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 obter exemplos de código, consulte o método e Complement(GraphicsPath) o Intersect(RectangleF).