DevExpress: Splash Screen Manager in C#

By FoxLearn 7/23/2017 9:58:32 PM   8.49K
How to use splash screen manager in C# with DevExpress

Step 1Click New Project, then select Visual C# on the left, then Windows and then select Windows Forms Application. Name your project "ProgressIndicatorExample" and then click OK

devexpress splashscreen manager

Step 2: Design your form as below

frmWaitForm

c# waitform dialog

Form1

devexpress watiform dialog

Step 3: Add code to handle your form as below

frmWaitForm

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

namespace ProgressIndicatorExample
{
    public partial class frmWaitForm : WaitForm
    {
        public frmWaitForm()
        {
            InitializeComponent();
            this.progressPanel1.AutoHeight = true;
        }

        #region Overrides

        public override void SetCaption(string caption)
        {
            //Set caption text
            base.SetCaption(caption);
            this.progressPanel1.Caption = caption;
        }
        public override void SetDescription(string description)
        {
            //Set description text
            base.SetDescription(description);
            this.progressPanel1.Description = description;
        }
        public override void ProcessCommand(Enum cmd, object arg)
        {
            base.ProcessCommand(cmd, arg);
        }

        #endregion

        public enum WaitFormCommand
        {
        }
    }
}

Form1

private void simpleButton1_Click(object sender, EventArgs e)
{
    //Show indicator
    SplashScreenManager.ShowForm(this, typeof(frmWaitForm), true, true, false);
    SplashScreenManager.Default.SetWaitFormCaption("Processing data...");
    for (int i = 0; i < 100; i++)
    {
        //Add your code here
        Thread.Sleep(10);//Only for demo
    }
    SplashScreenManager.CloseForm();
}

VIDEO TUTORIALS