version 6.0
DR Draw rectangle (area; startH; startV; endH; endV; mode; round) Longint
| Parameter | Type | Description | |
| area | Longint | 4D Draw area | |
| startH | Number | Horizontal position of start | |
| startV | Number | Vertical position of start | |
| endH | Number | Horizontal position of end | |
| endV | Number | Vertical position of end | |
| mode | Integer | 0 = Absolute | |
| 1 = Relative | |||
| round | Number | Corner rounding amount | |
| Function result | Longint | Object ID |
Description
The command DR Draw rectangle creates a new rectangle in area and returns the object's ID.
The new rectangle is created with the default line and fill attributes and positioned according to startH, startV, endH, and endV. All four coordinates are expressed in base units. Use the DR Scale to base function to convert from scale units to base units.
startH and startV are specified as offsets from the current origin.
endH and endV can be specified as offsets from the current origin (absolute) or offsets from startH and startV (relative).
If mode equals 0, endH and endV are absolute coordinates.
If mode equals 1, endH and endV are relative coordinates. Positive values indicate a direction down or right. Negative values indicate a direction up or left.
round controls the amount of corner rounding of the new rectangle. round is specified in base units. If round equals 0, the rectangle is created with no corner rounding.
Example
The following example creates a 10 by 10 grid of rectangles with random patterns and colors. Updating is left on to view the progress of the method.
DR SET ORIGIN (Area;0;0;0) `Set origin to upper left of the document For ($i;0;9) `$i is the horizontal position for each rectangle For ($j;0;9) `$j is the vertical position for each rectangle DR SET FILL ATTRIBUTES (Area;-2;Random % 33 + 3;Random ^ 2) `Set default fill attributes to random color & pattern $ID := DR Draw rectangle (Area;$i;$j;1;1;1;0) `Draw a new rectangle. Note relative coordinates. End for End for
See Also
DR SET FILL ATTRIBUTES, DR SET LINE ATTRIBUTES.