0

Does anyone know about Multiple Document Interfaces in C#? I'm having trouble with Form.Show(this) to keep one of the child forms perpetually on top of the rest. If the form already has an owner (set to MdiParent), then the program throws an exception when calling the show method.

Here's a switch case that's supposed to create and display a child form, but errors out due to the problem stated above. Are there any alternatives to this to keep the form on top of all the others?

case Page.Call:
if (call == null)
{
    call = new CallForm();
    call.MdiParent = this;
    call.Dock = DockStyle.Fill;
}
call.Show(this);
break;
  • Have a look at this - http://stackoverflow.com/questions/683330/how-to-make-a-window-always-stay-on-top-in-net – squillman Sep 11 '15 at 15:55
  • sounds like you should be using a popup – bilpor Sep 11 '15 at 15:56
  • Don't make that form an MDI Child. Make it a borderless control and dock it to a side. – LarsTech Sep 11 '15 at 16:01
  • If I don't make it an MDI Child, is there any good way to keep track of which form was the previously opened one? – Grant Denison Sep 11 '15 at 16:09
  • `this.ActiveMdiChild` – LarsTech Sep 11 '15 at 16:11
  • That's what I'm using now, but the program won't know if the call form was the previous form because it's not an mdichild. – Grant Denison Sep 11 '15 at 16:19
  • You are getting off topic. Use the @ sign in StackOverflow comments to reply to that person. Try the `MdiChildActivate` event and a variable to store the form that was activated. Now you know the last form. – LarsTech Sep 11 '15 at 16:23
  • Just to be on the same page: If that child is supposed fill the entire window and be above all other child forms at all times, wouldn't it render the rest useless? How will you be able to access them? – Volkan Paksoy Sep 11 '15 at 16:29
  • 1
    @LarsTech Thanks for the help, I'll ask another question if I need more answers. – Grant Denison Sep 11 '15 at 16:33
  • @VolkanPaksoy The child that will be on top at all times holds video feed, it re-sizes based off of which part the application is at. In pages other than where it's maximized, it acts like a video thumbnail. – Grant Denison Sep 11 '15 at 19:23

0 Answers0