Sign in to follow this  

[MDX, C#] Width of string in pixels.

This topic is 4397 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Given a string, with a DirectX font, how can I determine the width of a string in pixels?

Share this post


Link to post
Share on other sites
If you are using a Microsoft.DirectX.Direct3D.Font object for your font definition, you can use its MeasureString method to find out the dimensions of the string when it's rendered.

Share this post


Link to post
Share on other sites
This thread should be what you are looking for.

Edit: Beaten to it...it looks like Remiguis' way is easier though. Apparently .NET's font support is pretty spiffy [wink]

Share this post


Link to post
Share on other sites
Hum..

I'm having difficulty finding the MeasureString() procedure in my Font object. I'm using the December 2005 SDK, any ideas?

Edit: Oops, it turns out my references weren't up to date. I found it. Thanks btw. [grin]

Share this post


Link to post
Share on other sites

This topic is 4397 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this