For some unknown reason, the Graphics class's DrawRectangle method cannot take a RectangleF as a parameter. It can take a Rectangle or four Singles, and the FillRectangle method can take a RectangleF as a parameter, but the DrawRectangle method cannot.

Fortunately it's easy to add this as an overloaded version of the method by creating an extension method for the Graphics class. The following code shows how the example program does this.

Now the program can use the new version of the DrawRectangle method just as if it had been included in the original Graphics class. The following code shows how the example program draws its rectangle.