Easily set TopMost for all forms in a project?

  • Thread starter Thread starter james
  • Start date Start date
J

james

I have a project with 50+ forms that needs to be made topmost. Is
there a faster way than manually setting topmost=true for all forms in
the project? Then how do I guarantee that dialogs get set topmost?

Thanks,
James
 
Hi James,

I am intrigued as to why you would want to do this in the first place?

When you set a form's TopMost property to true then it will display above
all other forms that do not have their TopMost property set. If multiple
forms are displayed at the same time, all with their TopMost property set,
then they will essentially all have equal precedence. i.e. clicking any of
the forms will bring it to the top of the z-order and display it above all
others.

There is a difference with dialogues when using the ShowDialog() method.
When this method is called from a window that has its TopMost property set,
the corresponding form will always be displayed at the top of the z-order, In
addition, if it is a modal dialogue, other forms cannot receive focus whilst
it is being displayed.

If ShowDialog() is called from a form that does not have its topMost
property set then it will be displayed below any forms that do have their
TopMost property set. It can of course still be modal and this may produce
non-intuitive states where a modal form requires input but cannot be seen.

You can control this to some extent within your own application but
interesting combinations can arise where other applications use the TopMost
property themselves.

Perhaps you can determine another way of configuring your application or if
not, describe your requirement in a little more detail.

regards - wibberlet
Development blog at http://wibberlet.blogspot.com

================================================
 
Back
Top