|
-
May 2nd, 2006, 05:35 AM
#1
[2.0] Custom MessageBox Issues
I'm trying to create my own, custom MessageBox like class. I needed the buttons to say different things and have a slightly different look so I created a new form, put the bottons on a panel with a Dock of Bottom. I think put two buttons on that panel with no anchors so they will stay in the middle.
Now the issue is with displaying the text as it will be varying lengths. I put a label across the form and set the autosize to true. I then tried to compensate and have the form automatically adjust to the height of the label but that didn't seem to work as it likes to expand not only height wise but width wise, usually going off the screen if there is too much text.
Any suggestions on implimenting a custom MessageBox class that acts like a normal MessageBox? i.e. it can go off the screen but only the bottom of it and the width never goes beyond a certain point (not sure what the MessageBox is, maybe 80% of the screen, max?)
Last edited by Kasracer; May 3rd, 2006 at 06:07 PM.
-
May 3rd, 2006, 04:48 PM
#2
Re: [2.0] Custom MessageBox Issues
first of all, you should turn off the AutoSize property (if on the label will only fit to one line)
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
May 3rd, 2006, 06:07 PM
#3
Re: [2.0] Custom MessageBox Issues
 Originally Posted by ComputerJy
first of all, you should turn off the AutoSize property (if on the label will only fit to one line)
If I do that, then it will only show the text in whatever I size the label at. The problem with that is, I don't know how much text is going to be inserted into the label. It might be one like, it might be 56.
I just can't get the label to correctly expand.
Has anyone created their own MessageBox like form?
-
May 3rd, 2006, 11:26 PM
#4
Re: [2.0] Custom MessageBox Issues
You can use the Graphics.MeasureString () to calculate the string width and how many lines does it need, it's up to the size of your form then
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|