Re-size label text

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.
 
C

Cor Ligthert [MVP]

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
 
S

Stuart Nathan

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.
 
S

Sid Price

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.
 
C

Cor Ligthert [MVP]

Sid,

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

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

Cor
 

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

Top