开发者

Disable the window on the background

I have a window that opens another window. I want that when this window it's opened i can't do anything on the parent window. (I'm not allowed to click buttons for example) How开发者_运维技巧 I can do that?

Thanks.


You need to call the ShowDialog method instead of Show to show the second window as a modal dialog.


You want a modal window instead of a modeless window. A modal window means that the parent window is not usable while the child window is open.

You can open a modal window with ShowDialog.

You can open a modeless window with just Show.


I Recommend you to use MDI scenario behaving as child and parent windows but for instance according to the point you can use code below.

NewWindow.ShowDialog() method instead of NewWindow.Show() as it will disable background window 

but that's not good practice we should implement MDI.

I've never seen a desktop application opening on multiple windows and disabling older ones.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜