Search code examples
c#mdi

MDI child window cannot be displayed by .ShowDialog() WHY?


I use winforms MDI window and display child windows on it. I need to display some of them using modal dialog mode ( .ShowDialog() ) but still have them displayed as a child window (they should stay within the borders of the parent windows).

When I try to do this I get a compile time error saying that the child window cannot be displayed as a modal dialog mode window.

Is there any way to do it?


Solution

  • I don't think that there is direct way to do this. However, on the low level modal dialogs are implemented by disabling a parent window. Try to show modeless MDI child and keep parent disabled unless this child is closed.