The following example draws a group of rectangles.
C++
VOID Example_DrawRectangles2(HDC hdc)
{
   Graphics graphics(hdc);
   // Create a Pen object.
   Pen blackPen(Color(255, 0, 0, 0), 3);
   
   // Create an array of RectF objects.
   RectF rect1(0.0f, 0.0f, 100.0f, 200.0f);
   RectF rect2(100.0f, 200.0f, 250.0f, 50.0f);
   RectF rect3(300.0f, 0.0f, 50.0f, 100.0f);
   RectF rects[] = {rect1, rect2, rect3};
   RectF* pRects = rects;
   // Draw the rectangles.
   graphics.DrawRectangles(&blackPen, pRects, 3);
}
SUB GDIP_DrawRectangles (BYVAL hdc AS DWORD)
   LOCAL hStatus AS LONG
   LOCAL pGraphics AS DWORD
   LOCAL pPen AS DWORD
   LOCAL x AS SINGLE
   LOCAL y AS SINGLE
   LOCAL nWidth AS SINGLE
   LOCAL nHeight AS SINGLE
   hStatus = GdipCreateFromHDC(hdc, pGraphics)
   ' // Create a Pen
   hStatus = GdipCreatePen1(GDIP_ARGB(255,0, 0, 0), 3, %UnitPixel, pPen)
   ' // Create an array of RectF structures.
   DIM rc(2) AS RECTF
   rc(0).x = 0.0! : rc(0).y = 0.0! : rc(0).Width = 100.0! : rc(0).Height = 200.0!
   rc(1).x = 100.0! : rc(1).y = 200.0! : rc(1).Width = 250.0! : rc(1).Height = 50.0!
   rc(2).x = 300.0! : rc(2).y = 0.0! : rc(2).Width = 50.0! : rc(2).Height = 100.0!
   ' // Draw the rectangles
   hStatus = GdipDrawRectangles(pGraphics, pPen, rc(0), 3)
   ' // Cleanup
   IF pPen THEN GdipDeletePen(pPen)
   IF pGraphics THEN GdipDeleteGraphics(pGraphics)
END SUB
(http://www.jose.it-berater.org/captures/GdipDrawRectangles.png)