Form Activation

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I am currently involved in .Net windows form application, but in an uncommon
way.

The application has a main windows form which displays a title panel on top
and several navigation buttons at bottom. Whenever a button is clicked,
another assembly will be loaded on the fly, and a corresponding form will be
dynamically constructed from the loaded assembly and displayed in the middle
area on the screen on top of the main windows form.

The reason why we implemented this way is to separate each form related to
each button, so it is easier to debug.

The problem is, since the main windows form and the form dynamically created
are from different application domains, whenever the main windows form is
activated, the button form will be hidden behind. For example, if mouse is
clicked in the main windows form area between the buttons.

I wonder if anybody has been in this kind of project and how the problem is
solved.
Thanks,

Liping
 
Hi Liping,

You could try looking at the "TopMost" property.

Set the Topmost to true for all your dynamic forms. This would keep your
dynamic forms visible above the main form even when the main form is selected
with the mouse. The main form would still be usable so the buttons would
still be able to launched other dynamic forms.
If you want to limit the user to only one dymanic form at a time you could
try setting the "Enabled" property of the main form to false instead,
remembering to provide a re-enable of it somewhere in the dynamic forms
shutdown code.

Be Lucky
 
Hi Chris,

Thanks. But that will prevent other windows applications to work properly,
since
the dynamic form is topmost.

Think I need a way to know when other application's form is activated and
make the dynamic form non-topmost. And make it topmost again when my main
window is activated.


Liping
 
Back
Top