Skip to main content

Create and Show a Splash Form (WinForms)

  • 3 minutes to read

This topic describes how to create three splash forms (a Splash Screen, a Wait Form, and a Splash Image) and use them in an application.

Prerequisites

To use designer tools for DevExpress controls in .NET applications, install the DevExpress.Win.Design package from the local NuGet feed, or from a remote NuGet feed at https://nuget.devexpress.com.

Create and Use a Splash Screen or a Wait Form

There are two ways to create a Splash Screen or a Wait Form:

  • Create a new Windows Form in your WinForms Application project. Inherit the form from the SplashFormBase class or SplashFormBase descendant and customize the form.
  • Use the Splash Screen or the Progress Indicator template from the DXperience v24.1 Template Gallery project item. You can add or modify images and labels.

To use the Splash Screen or the Wait Form at the application’s startup, open the WinApplication.cs (WinApplication.vb) file and pass the form to any DXSplashScreen constructor as the xtraSplashFormType parameter.

namespace MySolution.Win {
    public partial class MySolutionWindowsFormsApplication : WinApplication {
        public MySolutionWindowsFormsApplication() { 
            // ...
            SplashScreen = new DXSplashScreen(typeof(MySplashScreenOrWaitForm));
            ExecuteStartupLogicBeforeClosingLogonWindow = true;
        }
        // ...
    }
}

To use the Wait Form with other splash forms, use a different constructor and pass the Wait Form as the waitFormType parameter.

You can use forms to indicate specific operations’ progress.

Use a Splash Image

To show a Splash Image, add an image file to the Images folder in the WinForms Application project and set the file’s Build Action property to Embedded Resource.

The following file types are acceptable:

  • SVG,
  • PNG,
  • other raster formats.

Note

You can use the Bitmap.MakeTransparent method to enable transparency for BMP images. You can also use an image editing application to convert your BMP file to PNG or another raster format that supports transparency.

To enable the image, access the WinApplication.cs (WinApplication.vb) file and assign the image to an Image or SVGImage object. Pass the object to the DXSplashScreen(Image) or DXSplashScreen(SvgImage) constructor to set the Splash Image as the application’s default Splash Screen.

Raster Image

using System.IO;
using System.Reflection;
using DevExpress.ExpressApp.Win.Utils;

namespace MySolution.Win {
    public partial class MySolutionWindowsFormsApplication : WinApplication {
        public MySolutionWindowsFormsApplication() {
            // ...
            Assembly executingAssembly = Assembly.GetExecutingAssembly();
            Stream splashImageStream = executingAssembly.GetManifestResourceStream(
                assembly.GetName().Name + ".Images.MySplashImage.png");
            SplashScreen = new DXSplashScreen(Image.FromStream(splashImageStream));
        }
        // ...
    }
}

SVG Image

using System.Reflection;
using DevExpress.Utils.Svg;
using DevExpress.ExpressApp.Win.Utils;

namespace MySolution.Win {
    public partial class MySolutionWindowsFormsApplication : WinApplication {
        public MySolutionWindowsFormsApplication() {
            // ...
            Assembly executingAssembly = Assembly.GetExecutingAssembly();
            SplashScreen = new DXSplashScreen(SvgImage.FromResources(
                assembly.GetName().Name + ".Images.SplashImage.svg", assembly));
        }
        // ...
    }
}

To use the Splash Image with other splash forms, use a different constructor.

After you enable the Splash Image, you can show it for specific operations to indicate their progress.