Example E3576
Visible to All Users

WinForms Splash Screen Manager - Interact with the Splash Screen by sending commands

This example adds a Progress Bar control to a Splash Screen and updates it dynamically by sending commands from the Splash Screen Manager.

The Splash Screen Manager displays Splash Screens in a separate thread. The Splash Screen Manager implements the command mechanism that allows you to interact with Splash Screens. Use the SplashScreenManager.SendCommand method to send and process commands (by overriding the SplashScreen.ProcessCommand method).

Files to Review

Documentation

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

Example Code

Form1.cs(vb)
C#
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; using System.Threading; namespace SplashScreen_ProcessCommand { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void btnShowSplashScreen_Click(object sender, EventArgs e) { // Open a Splash Screen SplashScreenManager.ShowForm(this, typeof(SplashScreen1), true, true, false); // The splash screen will be opened in a separate thread. To interact with it, use the SendCommand method. for (int i = 1; i <= 100; i++) { SplashScreenManager.Default.SendCommand(SplashScreen1.SplashScreenCommand.SetProgress, i); //To process commands, override the SplashScreen.ProcessCommand method. Thread.Sleep(25); } // Close the Splash Screen. SplashScreenManager.CloseForm(false); } } }
SplashScreen1.cs(vb)
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using DevExpress.XtraSplashScreen; namespace SplashScreen_ProcessCommand { public partial class SplashScreen1 : SplashScreen { public SplashScreen1() { InitializeComponent(); } #region Overrides public override void ProcessCommand(Enum cmd, object arg) { base.ProcessCommand(cmd, arg); SplashScreenCommand command = (SplashScreenCommand)cmd; if (command == SplashScreenCommand.SetProgress) { int pos = (int)arg; progressBarControl1.Position = pos; } } #endregion public enum SplashScreenCommand { SetProgress, Command2, Command3 } } }

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.