bringing modeless dialogs to front

  • Thread starter Gregory Khrapunovich
  • Start date
G

Gregory Khrapunovich

I have created a form (Windows Forms) that opens several modeless dialogs.
Sometimes they become covered by other (unrelated) applications and its
annoying to click on each dialog to make them visible again. I would like
all dialogs to become visible when main form becomes visible.

Main form has pointers to each dialog, so I guess all I need is to execute
dlg.BringToFront() for each modeless dialog. The question is when I should
do it. I created Paint event handler for the main form and put these
commands in it. It does the trick but creates other problems, such as main
menu doesn't show up when forms overlap. So where in the main form should I
place dlg.BringToFront() ?

Thank you.
Gregory
 
S

Scott

I would put your code in the Form.GotFocus or Form.Activated (or both)
events, and not the paint event.

Scott
 
G

Gregory Khrapunovich

When I put this code in the Activate handler, I cannot operate the main form
at all. As for GotFocus, I cannot find this event. Visual Studio doesn't
show it in the form properties.
Gregory
 

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