# RectangleF.IntersectRectangleF.IntersectRectangleF.IntersectRectangleF.Intersect Method

## Definição

Determina a estrutura RectangleF que representa a interseção de dois retângulos.Determines the RectangleF structure that represents the intersection of two rectangles.

## Sobrecargas

 Intersect(RectangleF, RectangleF) Intersect(RectangleF, RectangleF) Intersect(RectangleF, RectangleF) Intersect(RectangleF, RectangleF) Retorna uma estrutura RectangleF que representa a interseção de dois retângulos.Returns a RectangleF structure that represents the intersection of two rectangles. Se não houver nenhuma interseção e RectangleF vazio for retornado.If there is no intersection, and empty RectangleF is returned. Intersect(RectangleF) Intersect(RectangleF) Intersect(RectangleF) Intersect(RectangleF) Substitui esta estrutura RectangleF pela interseção de si mesmo e da estrutura RectangleF especificada.Replaces this RectangleF structure with the intersection of itself and the specified RectangleF structure.

## Intersect(RectangleF, RectangleF)Intersect(RectangleF, RectangleF)Intersect(RectangleF, RectangleF)Intersect(RectangleF, RectangleF)

Retorna uma estrutura RectangleF que representa a interseção de dois retângulos.Returns a RectangleF structure that represents the intersection of two rectangles. Se não houver nenhuma interseção e RectangleF vazio for retornado.If there is no intersection, and empty RectangleF is returned.

``````public:
static System::Drawing::RectangleF Intersect(System::Drawing::RectangleF a, System::Drawing::RectangleF b);``````
``public static System.Drawing.RectangleF Intersect (System.Drawing.RectangleF a, System.Drawing.RectangleF b);``
``static member Intersect : System.Drawing.RectangleF * System.Drawing.RectangleF -> System.Drawing.RectangleF``
``Public Shared Function Intersect (a As RectangleF, b As RectangleF) As RectangleF``

#### Parâmetros

a
RectangleF RectangleF RectangleF RectangleF

Um retângulo a fazer interseção.A rectangle to intersect.

b
RectangleF RectangleF RectangleF RectangleF

Um retângulo a fazer interseção.A rectangle to intersect.

#### Retornos

Uma terceira estrutura RectangleF cujo tamanho representa a área sobreposta dos dois retângulos especificados.A third RectangleF structure the size of which represents the overlapped area of the two specified rectangles.

### Exemplos

Este exemplo foi projetado para uso com Windows Forms, e ele requer PaintEventArgs `e`um OnPaint objeto de evento.This example is designed for use with Windows Forms, and it requires PaintEventArgs`e`, an OnPaint event object. O código cria dois RectangleF objetos e os desenha na tela em preto e vermelho.The code creates two RectangleF objects and draws them to the screen in black and red. Observe que eles precisam ser convertidos em Rectangle objetos para fins de desenho.Notice that they have to be converted to Rectangle objects for drawing purposes. Em seguida, o código cria RectangleF um terceiro Intersect usando o método, converte- Rectangleo em um e o desenha na tela em azul.Then the code creates a third RectangleF using the Intersect method, converts it to a Rectangle, and draws it to the screen in blue. Observe que o terceiro retângulo (azul) é a área de sobreposição dos outros dois retângulos:Notice the third (blue) rectangle is the area of overlap of the other two rectangles:

``````public:
void RectangleFIntersectExample( PaintEventArgs^ e )
{
// Create two rectangles.
RectangleF firstRectangleF = RectangleF(0,0,75,50);
RectangleF secondRectangleF = RectangleF(50,20,50,50);

// Convert the RectangleF structures to Rectangle structures and draw them to the
// screen.
Rectangle firstRect = Rectangle::Truncate( firstRectangleF );
Rectangle secondRect = Rectangle::Truncate( secondRectangleF );
e->Graphics->DrawRectangle( Pens::Black, firstRect );
e->Graphics->DrawRectangle( Pens::Red, secondRect );

// Get the intersection.
RectangleF intersectRectangleF = RectangleF::Intersect( firstRectangleF, secondRectangleF );

// Draw the intersectRectangleF to the screen.
Rectangle intersectRect = Rectangle::Truncate( intersectRectangleF );
e->Graphics->DrawRectangle( Pens::Blue, intersectRect );
}
``````
``````public void RectangleFIntersectExample(PaintEventArgs e)
{

// Create two rectangles.
RectangleF firstRectangleF = new RectangleF(0, 0, 75, 50);
RectangleF secondRectangleF = new RectangleF(50, 20, 50, 50);

// Convert the RectangleF structures to Rectangle structures and draw them to the

// screen.
Rectangle firstRect = Rectangle.Truncate(firstRectangleF);
Rectangle secondRect = Rectangle.Truncate(secondRectangleF);
e.Graphics.DrawRectangle(Pens.Black, firstRect);
e.Graphics.DrawRectangle(Pens.Red, secondRect);

// Get the intersection.
RectangleF intersectRectangleF =
RectangleF.Intersect(firstRectangleF,
secondRectangleF);

// Draw the intersectRectangleF to the screen.
Rectangle intersectRect =
Rectangle.Truncate(intersectRectangleF);
e.Graphics.DrawRectangle(Pens.Blue, intersectRect);
}
``````
``````Public Sub RectangleFIntersectExample(ByVal e As PaintEventArgs)

' Create two rectangles.
Dim firstRectangleF As New RectangleF(0, 0, 75, 50)
Dim secondRectangleF As New RectangleF(50, 20, 50, 50)

' Convert the RectangleF structures to Rectangle structures and

' draw them to the screen.
Dim firstRect As Rectangle = Rectangle.Truncate(firstRectangleF)
Dim secondRect As Rectangle = Rectangle.Truncate(secondRectangleF)
e.Graphics.DrawRectangle(Pens.Black, firstRect)
e.Graphics.DrawRectangle(Pens.Red, secondRect)

' Get the intersection.
Dim intersectRectangleF As RectangleF = _
RectangleF.Intersect(firstRectangleF, secondRectangleF)

' Draw the intersectRectangleF to the screen.
Dim intersectRect As Rectangle = _
Rectangle.Truncate(intersectRectangleF)
e.Graphics.DrawRectangle(Pens.Blue, intersectRect)
End Sub
``````

## Intersect(RectangleF)Intersect(RectangleF)Intersect(RectangleF)Intersect(RectangleF)

Substitui esta estrutura RectangleF pela interseção de si mesmo e da estrutura RectangleF especificada.Replaces this RectangleF structure with the intersection of itself and the specified RectangleF structure.

``````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 RectangleF RectangleF RectangleF

O retângulo a ser interseccionado.The rectangle to intersect.