0

I'm using MessageBox.Show() in a console application for a purpose. But, the header text displayed in the MessageBox is trimmed as it displays ending characters as "...".

Can I set the MessageBox window width to handle this behavior.

Please help me in this regard.

Thanks in advance.

user3220129
  • 503
  • 9
  • 24

2 Answers2

3

No, in the default MessageBox its not possible to change the size of it. But if you want it, you can create your own message box. Just create a new form, put some buttons inside, in icon if you wanto and some text. And when you want it to show, just simply call ut, like you open the form

See

here

C# formatting a MessageBox

Community
  • 1
  • 1
Ramesh Rajendran
  • 37,412
  • 45
  • 153
  • 234
  • 1
    One can create a user control instead of creating a new form, as user control can be used at multiple places. Just a suggestion. – Aditi Feb 28 '14 at 07:37
  • @Aditi . Yes that's a nice idea – Ramesh Rajendran Feb 28 '14 at 07:38
  • @Aditi, don't want to be picky, but how can you use a user control in this case? I mean don't we need a `form` to show the message?? – Bolu Feb 28 '14 at 11:02
  • Generally a normal form has .cs extension, but a user control has .ascx extension and calling a form is not a good practise if you want to make your own control. User control itself means combining of more than one control in a logical unit (like a group of text boxes for entering address information, etc.) – Aditi Feb 28 '14 at 11:17
  • @Aditi, that's correct, but I'm still confused, what does this to do with this question? – Bolu Feb 28 '14 at 16:02
0

It can't be done. You have to create your own Form mimicking that behavior.

You can try to use the Win32 call SetWindowPos As suggested here.

Patrick Hofman
  • 153,850
  • 22
  • 249
  • 325