How can I calculate the display width size of a string based on a font family (arial) and size in pixels (12px)? (if necessary, assume zoom level 100%)
I have seem a few posts about it, but I still cant figure it out.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try using the TextRenderer class – see MSDN documentation here: http://msdn.microsoft.com/en-us/library/69ye7hc8.aspx
Here is an example Console application that measures the string “This is some text”: