drawTextIn

drawTextIn(text:  String;
           x1:    Real;
           y1:    Real;
           x2:    Real;
           y2:    Real;
           color: Integer);

The drawTextIn method of the Window class draws a text string on a form or control within a bounded rectangle, using the current values of the drawFont and drawTextAlign properties.

The drawTextIn property is not affected by the mode defined in the drawMode property.

The drawTextIn method parameters are listed in the following table.

Parameter Description
text Text string that is to be drawn
x1, y1 Left and top points of the bounding rectangle
x2, y2 Right and bottom points of the bounding rectangle
color Color of the text

The text is drawn into the bounding rectangle with word wrap.

The parameter position units are Real primitive type values, in the units of the scaleMode property of the form or control. The way in which the text is drawn is determined by the value of the drawTextAlign property, as listed in the following table.

Window Class Constant Value Description
DrawTextAlign_Left 0 Left-aligned
DrawTextAlign_Right 1 Right-aligned
DrawTextAlign_Center 2 Center-aligned (centered)

Any embedded carriage return character within the text forces a new line for the remaining text. The text always starts at the vertical point specified by the y1 parameter.

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

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

cntrl.drawTextIn(cntrl.name, 0, 30, 100, 70, labelColor);