Font.DrawText Method (Sprite, String, Point, Int32)

Draws formatted text.

Namespace: Microsoft.WindowsMobile.DirectX.Direct3D
Assembly: Microsoft.WindowsMobile.DirectX (in microsoft.windowsmobile.directx.dll)

Syntax

'Declaration
Public Function DrawText ( _
    sprite As Sprite, _
    value As String, _
    pos As Point, _
    color As Integer _
) As Integer
'Usage
Dim instance As Font
Dim sprite As Sprite
Dim value As String
Dim pos As Point
Dim color As Integer
Dim returnValue As Integer

returnValue = instance.DrawText(sprite, value, pos, color)
public int DrawText (
    Sprite sprite,
    string value,
    Point pos,
    int color
)
public:
int DrawText (
    Sprite^ sprite, 
    String^ value, 
    Point pos, 
    int color
)
public int DrawText (
    Sprite sprite, 
    String value, 
    Point pos, 
    int color
)
public function DrawText (
    sprite : Sprite, 
    value : String, 
    pos : Point, 
    color : int
) : int

Parameters

  • sprite
    A Sprite that contains the string. Can be a null reference (Nothing in Visual Basic), in which case Direct3D renders the string with its own sprite object.
  • value
    The string to draw.
  • pos
    A Point structure that specifies the upper left-hand coordinates of where to draw the font.
  • color
    An integer color value.

Return Value

If the function succeeds, the return value is the height of the text in logical units. If Center or Bottom is specified in the format parameter, the return value is the offset from the top to the bottom of the drawn text. If the function fails, the return value is 0.

Remarks

This method must be called from inside of a BeginScene-method-to-EndScene-method code block.

Unless the NoClip format is used, this method clips the text so that it does not appear outside of the specified rectangle. All formatting is assumed to have multiple lines unless the 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.

.NET Framework Security

  • Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .

Platforms

Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

Version Information

.NET Compact Framework

Supported in: 2.0

See Also

Reference

Font Class
Font Members
Microsoft.WindowsMobile.DirectX.Direct3D Namespace