The Straight Dope

Go Back   Straight Dope Message Board > Main > General Questions

Reply
 
Thread Tools Display Modes
  #1  
Old 09-22-2005, 07:26 PM
Mr2001 Mr2001 is offline
Guest
 
Join Date: Dec 1999
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?
Reply With Quote
Advertisements  
  #2  
Old 09-22-2005, 11:28 PM
Caligulas Caligulas is offline
Guest
 
Join Date: Sep 2005
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...
Reply With Quote
  #3  
Old 09-22-2005, 11:29 PM
Caligulas Caligulas is offline
Guest
 
Join Date: Sep 2005
Hmm, C#? I meant Form.Show() in that case
Reply With Quote
  #4  
Old 09-23-2005, 02:07 AM
Mr2001 Mr2001 is offline
Guest
 
Join Date: Dec 1999
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.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 10:20 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Send questions for Cecil Adams to: cecil@chicagoreader.com

Send comments about this website to: webmaster@straightdope.com

Terms of Use / Privacy Policy

Advertise on the Straight Dope!
(Your direct line to thousands of the smartest, hippest people on the planet, plus a few total dipsticks.)

Publishers - interested in subscribing to the Straight Dope?
Write to: sdsubscriptions@chicagoreader.com.

Copyright © 2013 Sun-Times Media, LLC.