How to resize a label to display all the text


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
i have a label that holds the name of a process. It is possible that the name is too long to fit in the label. The label is not Autosized, and is anchored on the top, left and right, so it resizes within it's parent container (a splitter panel).



So, I'd like to be able to determine how long the text will be and either make the label larger (which just opens a whole pandoras box of issues, cause then a bunch of other stuff needs to be resized) or some other creative method to deal with this. Any ideas?
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Well, you could let it auto-size and put your controls in a TablePanel or FlowLayoutPanel which both handle re-arranging controls when the size of the controls change.  Or, you could just use the System.Drawing.Graphics.MeasureString() method and resize the label manually.  Or, rearrange your form so that you don't have anything to the right of the label (like with localized applications where the label is on top of the textbox rather than to the left of it) and let it grow to the appropriate size (within reason Wink).
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Thanks Ben. I mull these options over. BigGrin
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search