开发者

Locking a WinForms window when another form is shown?

I have a WinForms application, And somewhere in the program user can bring up another form like pop up window for example an About Us form. I want the main form to be locked (eg User can not do anything in the UI of main form). And when that pop-up window is closed the main form would be return to normal state.

This is my code (I think I on开发者_Python百科ly miss the way of locking my main form)

private void buttonAbout_Click(Object sender, EventArgs e)
{
     AboutUS abUs = new AboutUS();
     abUS.Show()
     this.LOCK!!!  /* How to lock current form? */

     abUS.FormClosing += delegate { /* How to Unlock main form */ };
 }


Use Form.ShowDialog() instead of Form.Show().

Also see a related question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜