Home > Back-end >  Form from external DLL does not Show after being minimized
Form from external DLL does not Show after being minimized

Time:01-18

This is probably behavior by design, but I'll ask anyway -

I call a form from another project dll in my main project. It is NOT Modal (ShowDialog) or TopMost, and I set a variable for the form once it's created ("frm = New ..."), so that I can check when it's already been created (user clicks a toolbar button to create it initially.)

The form displays, fires events etc. all perfectly.

However, if I MINIMIZE the form and then call frm.Show through code to bring it back, nothing happens. The form remains minimized.

frm.Show has no affect and doesn't seem to fire any other events.

The only way to bring it back is to click on the taskbar icon for the MAIN form, which then displays the MAIN form AND the minimized forms (as icons), and then click on the icon for the minimized form.

I've tried various events (.Activate, .Show, .ShowDialog, .Focus) NOTHING will bring the other form out of its minimized state other than physically clicking on the Taskbar MAIN app icon and then selecting it.

Also, the main application is not MDI...

???

Thanks.

CodePudding user response:

normally this should do it as suggested by @jimi

[TheForm].WindowState = FormWindowState.Normal

But sometimes this does not works for some dark reason, so you could use some other methods

form.Show();
form.BringToFront();
if (form.WindowState == FormWindowState.Minimized)
{
    ShowWindowAsync(form.Handle, 9); // 9 = SW_RESTORE
}

I am sure there is one of these that will fix your problem

  •  Tags:  
  • Related