Keeping a form on top of its application

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
 
A

Alexey Borzenkov

Try this:



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



Alexey Borzenkov
 
S

Steve Roberts

Thanks Alexey,

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

Thanks again,
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top