# RectangleF.Equality Operator (RectangleF, RectangleF)

.NET Framework (current version)

Tests whether two RectangleF structures have equal location and size.

Namespace:   System.Drawing
Assembly:  System.Drawing (in System.Drawing.dll)

## Syntax

```public static bool operator ==(
RectangleF left,
RectangleF right
)
```

#### Parameters

left
Type: System.Drawing.RectangleF

The RectangleF structure that is to the left of the equality operator.

right
Type: System.Drawing.RectangleF

The RectangleF structure that is to the right of the equality operator.

#### Return Value

Type: System.Boolean

This operator returns true if the two specified RectangleF structures have equal X, Y, Width, and Height properties.

## Examples

The following code example demonstrates how to use the Implicit(Rectangle to RectangleF), RectangleFand Equality members. This example is designed for use with a Windows Form. Paste this code into a form and call the ConvertRectangleToRectangleF method when handling the form's Paint event, passing e as PaintEventArgs.

```private void ConvertRectangleToRectangleF(PaintEventArgs e)
{

// Create a rectangle.
Rectangle rectangle1 = new Rectangle(30, 40, 50, 100);

// Convert it to a RectangleF.
RectangleF convertedRectangle = rectangle1;

// Create a new RectangleF.
RectangleF rectangle2 = new RectangleF(new PointF(30.0F, 40.0F),
new SizeF(50.0F, 100.0F));

// Create a custom, partially transparent brush.
SolidBrush redBrush = new SolidBrush(Color.FromArgb(40, Color.Red));

// Compare the converted rectangle with the new one.  If they
// are equal draw and fill the rectangles on the form.
if (convertedRectangle == rectangle2)
{
e.Graphics.FillRectangle(redBrush, rectangle2);
}

// Dispose of the custom brush.
redBrush.Dispose();
}

```

## Version Information

.NET Framework
Available since 1.1