Microsoft DirectX 8.0 (Visual Basic)

D3DXFont.DrawTextW

Draws formatted text on a Microsoft® Direct3D® device.

object.DrawTextW( _ 
    Text As String, _ 
    Count As Long, _ 
    DestRECT As RECT, _ 
    Format As Long, _ 
    Color As Long) As Long

Parts

object
Object expression that resolves to a D3DXFont object.
Text
The string to draw.
Count
Specifies the number of characters in the string. If Count is –1, then DrawTextW will compute the character count automatically. -1 might not be specified if Format includes DT_MODIFYSTRING.
DestRECT
RECT type that contains the rectangle, in logical coordinates, in which the text is to be formatted.
Format
A combinations of values from the CONST_DTFLAGS enumeration, specifying the text formatting. If Format includes DT_MODIFYSTRING, the function could add up to four additional characters to this string. The buffer containing the string should be large enough to accommodate these extra characters.
Color
D3DCOLORVALUE type, specifying the color of the text.

Error Codes

If the method fails, an error is raised and Err.Number can be set to one of the following values.

D3DERR_INVALIDCALL
D3DERR_NOTAVAILABLE
D3DERR_OUTOFVIDEOMEMORY
E_OUTOFMEMORY

For information on trapping errors, see the Microsoft® Visual Basic® Error Handling topic.

Remarks

The DrawTextW method uses the device context's selected font, text color, and background color to draw the text. Unless the DT_NOCLIP format is used, DrawText clips the text so that it does not appear outside the specified rectangle. All formatting is assumed to have multiple lines unless the DT_SINGLELINE format is specified.

If the selected font is too large for the rectangle, the DrawTextW method does not attempt to substitute a smaller font.

The DrawTextW method supports only fonts whose escapement and orientation are both zero.