Re-size label text

  • Thread starter Thread starter Sid Price
  • Start date Start date
S

Sid Price

I would like to have the text of a label resize to fit the label control
itself. I understand that the other way around is possible, i.e. having the
control resize to display the text (autosize property) but I can not seem to
find any sample or technique suitable for what I need. My label control is
set to fill a resizable form and I would like the text to scale as the form
is resized.

Thanks,
Sid.
 
Sid,

Just the Dock in my idea as it is in every control.

If that does not fit your problem, than the Anchor

Use it in the designer properties first than you get an idea,

I hope this helps,

Cor
 
My first thought was that you need to find the nearest font size to suit the
label height but this might then be too wide for the label.
I am afraid I don't have time to do this, but you could have a look at GDI+.
I would then use a Panel to draw the text on and I would look at the
StringFormat object to help do it. Top of my head this. Use Help for mo
info.
 
Cor Ligthert said:
Sid,

Just the Dock in my idea as it is in every control.

If that does not fit your problem, than the Anchor

Use it in the designer properties first than you get an idea,

I hope this helps,

Cor

Thanks for the response Cor, this is exactly what I am doing. My label
control automatically fits the panel as it is resized. However, my question
was related to resizing the text on the label as the control itself is
resized.

Sid.
 
Sid,

Just simple, don't do it, the result becomes ugly.

(You have to work with font settings, but it never fits)

Cor
 
Back
Top