Graphics drawing wouldn’t be graphics drawing if you couldn’t draw shapes. GDI+ supports the Rectangle, Ellipse, Polygon, and Pie shapes and also gives you the ability to draw other shapes that don’t fit these common ones.
Drawing rectangles is simple. You use the Rectangle class to define the rectangle boundaries, and then you draw it using whatever Pen and Brush you choose. Listing 7.8 shows the code for drawing a rectangle.
1: procedure DrawRectangle(aBrush: Brush); 2: var 3: MyRect: Rectangle; 4: begin 5: MyPen.Width := 5; 6: MyRect := Rectangle.Create(10, 10, 500, 250); 7: MyGraphics.DrawRectangle(MyPen, MyRect); 8: if Assigned(aBrush) then 9: MyGraphics.FillRectangle(aBrush, ...