开发者

Winforms: Open a second modal dialog in an already open modal dialog

I have an open modal dialog and open again a modal dialog from this dialog (with ShowDialog) The problem is now that the parent modal dialog is not locked and when I click on it the second modal dialog, it moves to the background. When I close the first modal dialog, the second one still remains on the desktop.开发者_Python百科 How can I prevent this behavior or what is the problem with this scenario?


Make sure you have set the dialog's Owner property. This tells WinForms/Win32 which window to disable when the new window goes modal. Do something like this:

secondDialog.Owner = firstDialog;
secondDialog.ShowDialog()

Or, try calling secondDialog.ShowDialog(firstDialog), which should set the owner chain for you.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜