calculate font size in pixel

  • Thread starter Thread starter antani
  • Start date Start date
A

antani

Hi, I should print many row (nameitem, quantity, price). I would like
print price item with justification to right. I need to know width
font size in pixel.

example:


ppp 1 10e
fffff 2 1e
 
Look at Graphics.MeasureString().

MeasureString is rarely any good when aligning text as it is just a rough but speedy measurement of the size of a given text and font. Instead use MeasureCharacterRanges. It is somewhat more complex to set up, but gives much better measurements.
 
Yeah, it's not terribly good, and I almost suggested calling
GetTextExtentExPoint, as that's the method we normally use in our custom
controls. It's expensive, but it's more accurate for some of the asian
fonts.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top