Keeping a form on top of its application

  • Thread starter Thread starter Steve Roberts
  • Start date Start date
S

Steve Roberts

I'm trying to keep a form on top of all other windows in its own
application, but not on top of all windows in all applications.



I can get it to be on top of all applications by setting "TopMost = true",
but can't get it to only be on top of its own application (i.e. when I
select another application the form I've made TopMost is still on top of
everything).



I've tried setting the MdiParent to be the application, but then the
"TopMost" property seems to have no effect (the code I was using for this is
shown below).



DebugControl debugCtrl = new DebugControl();

debugCtrl.MdiParent = this;

debugCtrl.TopMost = true;

debugCtrl.Show();






Has anyone any idea how I can do this?



Thanks in advance,

Steve
 
Try this:



DebugControl debugCtrl = new DebugControl();
debugCtrl..Owner = this;
debugCtrl.Show();



Alexey Borzenkov
 
Thanks Alexey,

That's fixed it - so I can stop tinkering with TopLevel, TopMost &Z-Orders.

Thanks again,
Steve
 
Back
Top