Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Show an Image as a Splash Screen and Draw Custom Information Over this Image

  • 6 minutes to read

In this example, an image is displayed as a splash screen via the SplashScreenManager.ShowImage method.Custom information is painted over this image via a custom class (SplashImagePainter), whose instance is passed as a parameter to the ShowImage method. The SplashImagePainter draws text labels with custom progress information.

View Example

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraSplashScreen;

namespace SplashScreenManagerSample01 {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
            LongInitialization();
        }
        protected void LongInitialization() {
            BaseInitialization();
            LoadFonts();
            LoadTextures();
        }

        void BaseInitialization() {
            // Set progress stage to be displayed by SplashImagePainter
            SplashImagePainter.Painter.ViewInfo.Stage = "Initialization";
            for(int i = 1; i <= 100; i++) {
                System.Threading.Thread.Sleep(20);

                // Change progress to be displayed by SplashImagePainter
                SplashImagePainter.Painter.ViewInfo.Counter = i;
                //Force SplashImagePainter to repaint information
                SplashScreenManager.Default.Invalidate();
            }
        }
        void LoadFonts() {
            // Set progress stage to be displayed by SplashImagePainter
            SplashImagePainter.Painter.ViewInfo.Stage = "Loading Fonts";
            for(int i = 1; i <= 100; i++) {
                System.Threading.Thread.Sleep(20);

                // Change progress to be displayed by SplashImagePainter
                SplashImagePainter.Painter.ViewInfo.Counter = i;
                //Force SplashImagePainter to repaint information
                SplashScreenManager.Default.Invalidate();
            }
        }
        void LoadTextures() {
            // Set progress stage to be displayed by SplashImagePainter
            SplashImagePainter.Painter.ViewInfo.Stage = "Loading Textures";
            for(int i = 1; i <= 100; i++) {
                System.Threading.Thread.Sleep(20);

                // Change progress to be displayed by SplashImagePainter
                SplashImagePainter.Painter.ViewInfo.Counter = i;
                //Force SplashImagePainter to repaint information
                SplashScreenManager.Default.Invalidate();
            }
        }
        //

        protected override void OnLoad(EventArgs e) {
            base.OnLoad(e);
            // Close splash image
            SplashScreenManager.HideImage();
        }
    }
}