[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?)
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)
Re: [2.0] Custom MessageBox Issues
Quote:
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?
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