drawFilledRectangle

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

The drawFilledRectangle method of the Window class draws 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 figure is filled using the color and style of the drawFillColor and drawFillStyle properties of the object.

The drawFilledRectangle method parameters are listed in the following table.

Parameter Description
x1, y1 Left and top points of the rectangle
x2, y2 Right and bottom points of the rectangle
color Color of the pen used

The position units of the parameters are Real primitive type values in the units of the scaleMode property of the form or control. If the width or the height of the rectangle is zero (0), the function does not draw the rectangle.

The figure drawn by this method extends up to but does not include the right and bottom coordinates. This means that the height of the figure is y2 through y1, and the width is x2 through x1. The width and the height of a rectangle must be in the range 2 units through 32,767 units.

When you use the drawFilledRectangle or drawSolidRectangle method to draw a solid rectangle, previous figures that were drawn in the history but are covered and all property settings that have been made redundant are removed. In addition, the drawLine method removes any previous lines with the same co-ordinates where the same width and drawStyle property values apply. The automatic process does not occur if you use flood-fill or after logic calls to the drawSize method.

To draw an unfilled rectangle, use the drawRectangle method or set the drawFillStyle property to DrawFillStyle_Transparent (1).

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

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