-3

In my GUI I want that when I click a button a modal dialog appear in-front of my GUI with the msg "busy". How can I do it?

Moreover, modal dialog should not have options of closing it (no cross button in top right corner). I want to close it programatically after 2-3 seconds of pressing button

PS: This is what I have so far

Form frm1 = new Form();
frm1.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
frm1.ClientSize = new System.Drawing.Size(200, 200);
frm1.ControlBox = false;
frm1.ShowDialog();
spajce
  • 7,044
  • 5
  • 29
  • 44
user1903439
  • 1,951
  • 7
  • 19
  • 29
  • Yes, you want, that's nice. Can't see a hint of what have you tried so far. – walther Feb 24 '13 at 15:36
  • In winforms you can't hide a close button - look [here](http://stackoverflow.com/questions/7301825/windows-forms-how-to-hide-close-x-button) or without border like proposed Aniket. – Ritro Feb 24 '13 at 15:39
  • Please don't repeat tags in question titles. – Ondrej Tucny Feb 24 '13 at 15:39
  • @Ritro, you can hide a close button, exactly as Aniket says; set the
    .ControlBox = false. Granted, you lose the min and max buttons as well, but oh well.
    – Immortal Blue Feb 24 '13 at 15:56
  • @ImmortalBlue, I think it even be better without the whole border and all buttons since it's like loading splash screen. – Ritro Feb 24 '13 at 16:02

1 Answers1

2

If you do not want the title bar on top then use the code below (do remember to look into MSDN for more info on each of these)

Form f = new Form();
f.FormBorderStyle=FormBorderStyle.None; //no border frame, close button etc gone!
f.ShowDialog(); // Modal dialog

If you only want to hide all the buttons above on the top-right corner:

f.ControlBox = false;
Aniket Inge
  • 25,375
  • 5
  • 50
  • 78