Application.Run question
-
Hi all, I've a question about Application.Run, which is supposed to start the main loop for receiving messages for windows.forms applications. What I want to do is hide the form on startup, which I do either with setting the Visibility property to false or calling Hide(); so far no problems with that. But when I start the loop with Application.Run(form); it makes the form visible. The thing is that it makes the form visible after calling the constructor so what's the proper way of starting a form with Application.Run(Form); which will be hidden? Any advice is appreaciated ;) Regards
-
Hi all, I've a question about Application.Run, which is supposed to start the main loop for receiving messages for windows.forms applications. What I want to do is hide the form on startup, which I do either with setting the Visibility property to false or calling Hide(); so far no problems with that. But when I start the loop with Application.Run(form); it makes the form visible. The thing is that it makes the form visible after calling the constructor so what's the proper way of starting a form with Application.Run(Form); which will be hidden? Any advice is appreaciated ;) Regards
-
Hi all, I've a question about Application.Run, which is supposed to start the main loop for receiving messages for windows.forms applications. What I want to do is hide the form on startup, which I do either with setting the Visibility property to false or calling Hide(); so far no problems with that. But when I start the loop with Application.Run(form); it makes the form visible. The thing is that it makes the form visible after calling the constructor so what's the proper way of starting a form with Application.Run(Form); which will be hidden? Any advice is appreaciated ;) Regards
-
Hi all, I've a question about Application.Run, which is supposed to start the main loop for receiving messages for windows.forms applications. What I want to do is hide the form on startup, which I do either with setting the Visibility property to false or calling Hide(); so far no problems with that. But when I start the loop with Application.Run(form); it makes the form visible. The thing is that it makes the form visible after calling the constructor so what's the proper way of starting a form with Application.Run(Form); which will be hidden? Any advice is appreaciated ;) Regards
Now I remember how I did it. It helps to go back and actually look at the damn code! Override OnLoad and set the form's Opacity to 0. When you need to show the form, reset the Opacity to 1. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
That doesn't work. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Hi all, I've a question about Application.Run, which is supposed to start the main loop for receiving messages for windows.forms applications. What I want to do is hide the form on startup, which I do either with setting the Visibility property to false or calling Hide(); so far no problems with that. But when I start the loop with Application.Run(form); it makes the form visible. The thing is that it makes the form visible after calling the constructor so what's the proper way of starting a form with Application.Run(Form); which will be hidden? Any advice is appreaciated ;) Regards
What else do you want to do other than hiding the (main) form of the application? I assume you want to launch another form for login or splash or something similar. I suggest placing the code that you want to execute while keeping your form hidden in the OnLoad event delegate of that form. At some point, you will return from that code and continue with the execution of the delegate. I guess you could set the Visible property to false within the OnLoad delegate, but then what do you get to do in your application? Maybe I didn't understand your desired behavior, but I suggest using the form's OnLoad delegate, because before that delegate is finished the form is not shown.