Share via


Font.MeasureString Method

Measures the specified string when drawn with the specified Font object and formatted with the specified StringFormat object.

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

Syntax

'Declaration
Public Function MeasureString ( _
    sprite As Sprite, _
    value As String, _
    ByRef rectangle As Rectangle, _
    format As DrawTextFormat _
) As Rectangle
'Usage
Dim instance As Font
Dim sprite As Sprite
Dim value As String
Dim rectangle As Rectangle
Dim format As DrawTextFormat
Dim returnValue As Rectangle

returnValue = instance.MeasureString(sprite, value, rectangle, format)
public Rectangle MeasureString (
    Sprite sprite,
    string value,
    ref Rectangle rectangle,
    DrawTextFormat format
)
public:
Rectangle MeasureString (
    Sprite^ sprite, 
    String^ value, 
    Rectangle% rectangle, 
    DrawTextFormat format
)
public Rectangle MeasureString (
    Sprite sprite, 
    String value, 
    /** @ref */ Rectangle rectangle, 
    DrawTextFormat format
)
JScript does not support passing value-type arguments by reference.

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 measure.
  • rectangle
    A reference to a Rectangle structure that contains the rectangle, in logical coordinates, in which the text is being formatted.
  • format
    The method of formatting the text; can be any combination of values from the DrawTextFormat enumeration.

Return Value

A Rectangle.

.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