Control Reference > VSPrinter Control > VSPrinter Methods > TextBox Method |
Draws text within a rectangle.
[form!]VSPrinter.TextBox Text As String, X As Variant, Y As Variant, Width As Variant, Height As Variant, [ Wrap As Variant ], [ Calc As Variant ], [ Shade As Variant ]
The parameters for the TextBox method are described below:
Parameter |
Description |
Text |
Text to be drawn in the text box. It may be plain text or, if the AutoRTF property is set to True, it may contain RTF text enclosed in curly braces ("{}"). |
X, Y, |
Coordinates of the upper left corner of the box. You may specify the units for these parameters. The default unit is twips. |
Width |
The width of the text box, in twips or explicit units. |
Height |
The height of the text box, in twips or explicit units. If this parameter is set to zero, the height is calculated automatically so the text fits within the box. |
Wrap |
Specifies whether text should be allowed to wrap within the box. Optional, defaults to True. |
Calc |
Specifies whether the text box should only be calculated, and not rendered. Optional, defaults to False. If you set this parameter to True, no text is drawn and the dimensions of the text box are returned in the TextWid and TextHei properties. This is useful if you want to determine whether a text box will fit on the current page. |
Shade |
Specifies whether the text box will be outlined with the current pen and shaded with the current brush. Optional, defaults to False. |
Several properties affect the way text is drawn within the text boxes. The main ones are Font, TextColor, TextAlign, TextAngle, SpaceBefore, SpaceAfter, IndentLeft, IndentRight, and LineSpacing.
You can use the TextBox method to build sophisticated reports with total control over text positioning and page breaks, or forms with arbitrary field positioning.