Font.MeasureString Method

Language:

Measures the rectangular dimensions of the specified text string when drawn with the specified Sprite object and formatted with the specified DrawTextFormat method of formatting text.

Definition

Visual Basic Public Function MeasureString( _
    ByVal sprite As Sprite, _
    ByVal text As String, _
    ByVal format As DrawTextFormat, _
    ByVal color As Color _
) As Rectangle
C# public Rectangle MeasureString(
    Sprite sprite,
    string text,
    DrawTextFormat format,
    Color color
);
C++ public:
Rectangle MeasureString(
    Spritesprite,
    Stringtext,
    DrawTextFormat format,
    Color color
);
JScript public function MeasureString(
    sprite : Sprite,
    text : String,
    format : DrawTextFormat,
    color : Color
) : Rectangle;

Parameters

sprite Microsoft.DirectX.Direct3D.Sprite
A Sprite object that contains the string.
text System.String
String to measure.
format Microsoft.DirectX.Direct3D.DrawTextFormat
Method of formatting the text; can be any combination of values from the DrawTextFormat enumeration.
color System.Drawing.Color
Color of the text. For more information, see Color Leave Site.

Return Value

System.Drawing.Rectangle
A Rectangle Leave Site structure that contains the rectangle, in logical coordinates, that encompasses the formatted text string.


Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.

Feedback? Please provide us with your comments on this topic.