C#: My app is started minimized, how can I show a form?

I’m writing a .NET program that will be launched by an external application in the minimized state (i.e. the other app sets WindowStyle to Minimized in the ProcessStartInfo structure it uses to start my program).

I want to pop up a form in the middle of the screen with ShowDialog(), but the form insists on staying minimized until I click its taskbar icon. I’ve tried setting the form’s WindowState property, but even though the property value changes from Minimized to Normal, the form stays minimized.

I have noticed, however, that when I call MessageBox.Show(), that box appears in the middle of the screen, so there must be some way to do it.

In Delphi, I’d call Application.Restore() to unminimize the whole program, but I don’t see an equivalent in .NET. How can I make my form appear without having to unminimize it by hand?

Does Form::Show() work, maybe? I’m thinking maybe it just creates some invisible window to just show up in the taskbar, not the actual real window…

Hmm, C#? I meant Form.Show() in that case :smiley:

Well, it turns out setting the WindowState to Normal in the Load event (instead of the Resize event or the constructor) solved the problem. Can’t believe I didn’t try that sooner. :smack: