measurestring

  • Thread starter Thread starter Nathan Franklin
  • Start date Start date
N

Nathan Franklin

Hello guys!

i was wandering about the measurestring function from the graphics object.

Because CF doesnt support AutoSize I am using MeasureString to set the width
of a label....
The width property isnt actually ever set long enough....

Someone told me that this was because MeasureString only does averages....

Is this the case?

How can I fix this problem?

Thanks in advance

nathan
 
This depends on whether the font you are using is fixed length or variable
length. For example using a fixed length font "Courier" you can simply
calculate the first character then multiple this by the
length of the field. But do this under a variable length such as "Arial" you
wont get the correct length.
To get around this you will need to calculate the whole string char by char,
although this can be expensive.

Regards
Simon.
 
Back
Top