Region.Intersect Método

Definição

Atualiza este Region para a interseção de si mesmo com o Region especificado.

Sobrecargas

Intersect(GraphicsPath)

Atualiza este Region para a interseção de si mesmo com o GraphicsPath especificado.

Intersect(Rectangle)

Atualiza este Region para a interseção de si mesmo com a estrutura Rectangle especificada.

Intersect(RectangleF)

Atualiza este Region para a interseção de si mesmo com a estrutura RectangleF especificada.

Intersect(Region)

Atualiza este Region para a interseção de si mesmo com o Region especificado.

Intersect(GraphicsPath)

Origem:
Region.cs
Origem:
Region.cs
Origem:
Region.cs

Atualiza este Region para a interseção de si mesmo com o GraphicsPath especificado.

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 realizar a interseção com este Region.

Exemplos

Para obter exemplos de código, consulte os RectangleF.Intersect(RectangleF) métodos e Complement(GraphicsPath) .

Aplica-se a

Intersect(Rectangle)

Origem:
Region.cs
Origem:
Region.cs
Origem:
Region.cs

Atualiza este Region para a interseção de si mesmo com a estrutura Rectangle especificada.

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

rect
Rectangle

A estrutura Rectangle a ser interseccionada com este Region.

Exemplos

Para obter um exemplo de código, consulte o Intersect(RectangleF) método .

Aplica-se a

Intersect(RectangleF)

Origem:
Region.cs
Origem:
Region.cs
Origem:
Region.cs

Atualiza este Region para a interseção de si mesmo com a estrutura RectangleF especificada.

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 estrutura RectangleF a ser interseccionada com este Region.

Exemplos

O exemplo de código a seguir foi projetado para uso com Windows Forms e requer PaintEventArgse, que é um parâmetro do Paint manipulador de eventos. 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)

Origem:
Region.cs
Origem:
Region.cs
Origem:
Region.cs

Atualiza este Region para a interseção de si mesmo com o Region especificado.

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

region
Region

O Region para realizar a interseção com este Region.

Exemplos

Para obter exemplos de código, consulte o Intersect(RectangleF) método e Complement(GraphicsPath).

Aplica-se a