Form usable even when a modal dialog is above
-
21-09-2019 - |
Question
I have a Dialog A and I want it to load a second 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#.
OTHER TIPS
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.