adjust font to label height?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

ive read the posts about adjusting height to font, but i want to adjust font
to height. is there an easy solution to this?

thanks in advance,
tim
 
The only way I can think of
would be creating your own Label Class
and overriding the OnPaint Method
There you can get the Height of your Label
and based on it select a coresponding FontSize.


But I dont know if you can derive from "Label"
because for example deriving from Button is Pointless
because this is only a wrapper for an OS-Button
 
im currently resizing my controls in the resize event; im trying to figure
out if theres an easy way to get the font that will fit the height of the
label. the only soln i could think of is creating a loop and increasing the
font size and checking if the font fits the height of the label but i was
hoping theres an easier soln...
 
I hardly believ you have another solution

The Height Property isn't supported in the Compact Framework

If it takes to much time, you can try to create an fixed multiplier for
this calculation
(simple go through the loop, generate all Heights in pixel and try to
figure out an
mutliplier)

If there is no constant multiplier (if its a function of higher order)
you can try to create
an array of Font heights (integer) where for example the 10 elemet
contains the font height which result in 10 pixel height and so on. But
I think this is a little bit overdesigned...

regards Norbert
 
im working in the v1.1 cf and the label height property works fine.

based on the responses, i guess looping through and increasing the font size
is the only soln...
 
Back
Top