Custom msgbox... resize to fit text?

B2Ben

Well-known member
Joined
Aug 17, 2006
Messages
52
Programming Experience
Beginner
I'd like to build a simple msgbox-style form, that can display a little or a lot of text, and resize itself appropriately to display it.

How can I make my form and label resize correctly?

Any assistance is appreciated :)

Thanks
 
Try setting both label and form AutoSize=True.
 
OK, that is new to me - that you are using .Net 1.1 I mean. Is your profile wrong or do you use both? If so it is important to tell with the request what platform goes since the libraries are so much expanded to 2.0. You can edit your forum profile to one platform.

See my reply post 2 here about measuring string for label, you can limit the measure for example to max width using one overload method of MeasureString that takes more input parameters. When you have measured the label and sized it you also have to size the form.
 
Excellent... I'm getting closer - Thanks.

When I resize the form, it's including the title bar and bottom border height in the overall pixel height of the form... how can I determine these heights and include them in my new Form.Height?
 
Use the ClientSize instead.
 
B2Ben initially requested how to build a custom MessageBox form.
 
Back
Top