You can get the width of text using the MeasureString method of a graphics object which will then return the size based on the string and the font you used:
Code:
Dim gr As Graphics = Me.CreateGraphics()
Dim wth As Single = gr.MeasureString("Some text is there", Me.Font).Width
This is a little different, but wondering if MeasureString could be used in the following.
I am making reports and need to show data in columns. Problem is with TT Fonts, the letter widths all vary, so its hard to align them to so they look right justified.
Is the MeasureString accurate enough to be able to work out the start position and end up having them aligned correctly.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.