A splash screen (or, something that does what the DevExpress WaitForm does) is simply a form that is displayed while your app does something, and that is later hidden when the app is ready to move on.
So - you can create your own form, that contains the images, text, etc., that you want on your splash screen. That form might use a timer that ticks every 1/10th of a second, say, if you want to have an animation (which you'll have to create, or you might build an animated GIF). The interesting part is how to display the form, then replace it with 'the main form' of the application.
I trust that you're at least minimally familiar with the
Application
object. (In Visual Studio, create a new WinForms project and open the Program.cs file).
Application.Run()
is where the action starts: typically (as in Program.cs) it takes an instance of a
Form
. You should read the MSDN documentation for the Application object, because it can do more sophisticated things.
But you may not need to. You might be able to do something like this:
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new SplashScreen());
Application.Run(new MainApplicationForm());
}
}
Clearly, while the
SplashScreen
form is visible, the application must do some important things, namely:
(a) Get the CPU, GPU, etc. information into some public static storage, for later use by the application
(b) Close the splash screen when that data has been retrieved.
(c) Wait before starting the main application behaviour until that work is done. (The example above accomplishes this because the second Run() method won't be invoked until the first has exited). There are almost certainly more graceful approaches than invoking Run() twice, but it works.
There are many ways of doing this; one would be to create a worker thread (pay attention to Form.Invoke - inherited from Control - to take action on a form from some thread other than the one it was created on); another would be to have the splash screen do that work, and close itself when done.
Note - if you haven't come across the topic before, understanding the difference between Modal and Modeless forms would be useful here; also, read about the differences between
Form.Show()
and
Form.ShowDialog()
.
Hope that helps!
Chris
(Hmm: No funds to buy DevExpress == learning opportunity! :)