Skip to main content

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

Displays an image as a splash form, allowing you to manually position it 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.v23.2.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

public static void ShowImage(
    Image image,
    bool useFadeIn,
    bool useFadeOut,
    SplashFormStartPosition startPos,
    Point location,
    ICustomImagePainter painter
)

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 opening the form; otherwise, false.

useFadeOut Boolean

true to use the fade-out effect when closing the form; otherwise, false.

startPos SplashFormStartPosition

The splash form’s arrangement.

location Point

Coordinates at which the splash form is shown (if the startPos parameter is set to Manual).

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.

The startPos parameter, if set to Manual, allows you to manually position the image using the loc parameter coordinates. See Splash Form Position to learn more.

Example

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