SplashScreenManager.ShowImage(Image, Boolean, Boolean, ICustomImagePainter) Method

Displays an image as a splash form, centering the image against your application's main form. Allows you to disable fade-in and fade-out effects for the image and draw custom graphics over the splash image.

Namespace: DevExpress.XtraSplashScreen

Assembly: DevExpress.XtraEditors.v20.1.dll

Declaration

public static void ShowImage(
    Image image,
    bool useFadeIn,
    bool useFadeOut,
    ICustomImagePainter painter
)
Public Shared Sub ShowImage(
    image As Image,
    useFadeIn As Boolean,
    useFadeOut As Boolean,
    painter As ICustomImagePainter
)

Parameters

Name Type Description
image Image

An Image to be displayed as a splash form.

useFadeIn Boolean

true to use the fade-in effect when the image opens; otherwise, false.

useFadeOut Boolean

true to use the fade-out effect when the image closes; otherwise, false.

painter DevExpress.XtraSplashScreen.ICustomImagePainter

An ICustomImagePainter object that implements a custom drawing procedure.

Remarks

You can draw custom graphics over the image by using the current ShowImage method and providing an ICustomImagePainter parameter. You need to create a class supporting the ICustomImagePainter interface and implement a paint procedure via the ICustomImagePainter.Draw method. The ICustomImagePainter.Draw method will be invoked each time the splash image is redisplayed. If required, you can dynamically update the splash image by calling the SplashScreenManager.Invalidate method, forcing your ICustomImagePainter.Draw method to be recalled.

Examples

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.

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();
        }
    }
}
See Also