开发者

Form usable even when a modal dialog is above [duplicate]

This question already has answers here: Is it possible to use ShowDialog without blocking all forms? (11 answers) Closed 2 years ago.

I have a Dialog A and I want it to load a se开发者_如何学Gocond dialog B which is modeless and stays along side A throughout. Dialog A may then launch a modal dialog C. But when C is present I want B to be usable. I would have fixed this with pretranslate message in A in a C++ application but what is the approach in C#.


When you launch Dialog C, launch it using yourFormVariable.Show() instead of yourFormVariable.ShowDialog().

Form form1 = new Form();
Form form2 = new Form();
form1.Show();
form2.Show();

This will allow both forms to be active and usable by the user, whereas in the following code:

Form form1 = new Form();
Form form2 = new Form();
form1.Show();
form2.ShowDialog();

the user will have to close form2 before they can continue to use form1 again.

Note that there is no such thing as a modal dialog that allows the previous forms to be usable - a modal dialog by definition is one that the user has to interact with and close before continuing.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜