DR Draw rectangle

4D - Documentation   Français   English   German   4D Draw 2004, Command Theme List   4D Draw 2004, Command Alphabetical List   Back   Previous   Next

version 6.0


DR Draw rectangle (area; startH; startV; endH; endV; mode; round) Longint

ParameterTypeDescription
areaLongint4D Draw area
startHNumberHorizontal position of start
startVNumberVertical position of start
endHNumberHorizontal position of end
endVNumberVertical position of end
modeInteger0 = Absolute
1 = Relative
roundNumberCorner rounding amount
Function resultLongintObject 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.


4D - Documentation   Français   English   German   4D Draw 2004, Command Theme List   4D Draw 2004, Command Alphabetical List   Back   Previous   Next