drawRectangle

drawRectangle(x1:    Real;
              y1:    Real;
              x2:    Real;
              y2:    Real;
              color: Integer);

The drawRectangle method of the Window class draws the border of a rectangle on a form or control using a colored pen the width of the drawWidth property, the style of the drawStyle property, and the mode of the drawMode property.

If this method is not called from a paint event, set the autoRedraw property to true.

The inside of the rectangle is not filled. If the width or the height of the rectangle is zero (0), the function does not draw the rectangle.

The figure drawn by this function extends up to and includes the right and bottom coordinates.

The figure drawn by this rectangle is equivalent to using the drawFilledRectangle method with the drawFillStyle property set to DrawFillStyle_Transparent (1).

The drawRectangle method parameters are listed in the following table.

Parameter Description
x1, y1 Horizontal and vertical left and top points of the rectangle
x2, y2 Horizontal and vertical right and bottom points of the rectangle
color Color of the pen used

The code fragment in the following example shows the use of the drawRectangle method.

frame.drawRectangle(30, 100, 70, 200, Red);