C# Winforms: Multiple top level windows and ShowDialog()

c++modal-dialogwinforms

I have a Winforms application that uses show multiple top-level windows:

Form1 form1 = new Form1();
form1.Show();
Form2 form2 = new Form2();
form2.Show();
Application.Run();

Inside one of the event-handlers in Form1, I would like to be able to show a modal dialog:

Dialog dialog = new Dialog();
dialog.ShowDialog(form1);

without suspending the other top-level window.

Is this possible?

Best Solution

You'd need to run each top-level window on its own STA thread to achieve that, I believe.