Form usable even when a modal dialog is above [duplicate]
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.
精彩评论