Microsoft DirectX 8.1 (Visual Basic)

D3DXFont.DrawText

Draws formatted text on a Microsoft® Direct3D® device.

object.DrawText( _ 
    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 DrawText 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
Long value that specifies the color of the text.

Error Codes

If the function succeeds, the return value is the height of the text in logical units. If DT_VCENTER or DT_BOTTOM is specified, the return value is the offset from lpRect->top to the bottom of the drawn text.

If the function fails, the return value is zero.

Remarks

DrawText must be called inside a Direct3DDevice8.BeginScene/Direct3DDevice8.EndScene block.

This method uses the device context's selected font, text color, and background color to draw the text. Unless the DT_NOCLIP format is used, this method 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, this method does not attempt to substitute a smaller font.

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