K
Kevin
I have just moved from 1.1, where I had my splash screen to a tee, to
2.0 where I find it impossible to get a satisfactory solution and its
driving me mad!
This is how a splash screen SHOULD work (and did in 1.1) when you load
a program (MICROSOFT, please take note!!!):
Splash screen appears
Login screen appears, user enters credentials.
If the login was successful the login box disappears, and the main form
starts loading. Whilst it is loading (which can take a few seconds) it
spits out messages to the splash screen (e.g. "retrieving accounts",
"populating listboxes" etc etc)
once the Main form has finished initialising it should appear BEHIND
the splash screen.
The splash screen should then disappear.
The whole time the splash screen should remain responsive with no
unpainted areas etc. It is also useful to show a "please wait..." with
an increasing/decreasing number of full stops or a progress bar to show
the user that the program is doing things.
In 1.1 I achieved this by creating the splash screen on a different
thread to the main one and then calling delegates to update the message
etc.
Unfortunately in .NET 2.0 this has changed. With the built in methods
for showing the splash screen, it basically shows the splash screen for
a predetermined amount of time and then it disappears and then creates
the main form. Only then can you initialise the main form, at which
point the user is confronted with a blank screen whilst the
initialisation occurs. No good.
With my old 1.1 way in 2.0, the program complains about crossthread
exceptions all the time because the splash screen is created on a
different thread. Turning them off (with
control.checkforillegalcrossthreadenabled = false)causes random
crashes, and isnt an ideal solution anyway.
So how can I do it? I need the splash screen to be responsive to
painting the whole time. I have tried putting a thread on it which
updates it every 250 milliseconds, and then calls Application.DoEvents.
This works fine as long as nothing else is happening, but as soon as I
initialise my main form these stop as they get held up in the message
queue.
This example does a lot of what I am after:
http://www.codeproject.com/useritems/CustomSplashScreen.asp
However, it does not allow the ability to add a login screen as there
is no message pump.
Please can someone help me as I am going mad here. Its such a simple
thing I am trying to do and yet it seems so hard!!!!
Thanks
Kevin
2.0 where I find it impossible to get a satisfactory solution and its
driving me mad!
This is how a splash screen SHOULD work (and did in 1.1) when you load
a program (MICROSOFT, please take note!!!):
Splash screen appears
Login screen appears, user enters credentials.
If the login was successful the login box disappears, and the main form
starts loading. Whilst it is loading (which can take a few seconds) it
spits out messages to the splash screen (e.g. "retrieving accounts",
"populating listboxes" etc etc)
once the Main form has finished initialising it should appear BEHIND
the splash screen.
The splash screen should then disappear.
The whole time the splash screen should remain responsive with no
unpainted areas etc. It is also useful to show a "please wait..." with
an increasing/decreasing number of full stops or a progress bar to show
the user that the program is doing things.
In 1.1 I achieved this by creating the splash screen on a different
thread to the main one and then calling delegates to update the message
etc.
Unfortunately in .NET 2.0 this has changed. With the built in methods
for showing the splash screen, it basically shows the splash screen for
a predetermined amount of time and then it disappears and then creates
the main form. Only then can you initialise the main form, at which
point the user is confronted with a blank screen whilst the
initialisation occurs. No good.
With my old 1.1 way in 2.0, the program complains about crossthread
exceptions all the time because the splash screen is created on a
different thread. Turning them off (with
control.checkforillegalcrossthreadenabled = false)causes random
crashes, and isnt an ideal solution anyway.
So how can I do it? I need the splash screen to be responsive to
painting the whole time. I have tried putting a thread on it which
updates it every 250 milliseconds, and then calls Application.DoEvents.
This works fine as long as nothing else is happening, but as soon as I
initialise my main form these stop as they get held up in the message
queue.
This example does a lot of what I am after:
http://www.codeproject.com/useritems/CustomSplashScreen.asp
However, it does not allow the ability to add a login screen as there
is no message pump.
Please can someone help me as I am going mad here. Its such a simple
thing I am trying to do and yet it seems so hard!!!!
Thanks
Kevin