Display Settings in Windows Forms Splash Panel

29 Apr 20217 minutes to read

The section illustrates the display settings available for the SplashPanel control.

The SplashPanel can be displayed or hidden according to the needs of the user. It can be displayed at any specified location. The display settings of the SplashPanel control are illustrated through the following methods.

Methods Table

Methods Description
ShowSplash Displays the SplashPanel.
HideSplash Hides the SplashPanel.
ShowDialogSplash Displays the SplashPanel as a modal dialog.
IsShowing Indicates whether the splash is currently displayed.

NOTE

The time interval for which the SplashPanel is displayed can be customized using the Time Interval settings provided in the SplashPanel control.

The above methods are explained below in detail.

ShowSplash() - This method is used to display the SplashPanel at run time.

The parameters discussed for the ShowSplash() method are as follows.

Parameters Table

Parameters Description
Location Indicates the point in screen coordinates. The value can be 'Point.Empty'.
OwnerForm Indicates the form that will embed the splash form.
DisableOwner Indicates whether the owner form is to be disabled.

When the SplashPanel is getting displayed, the owner form will be disabled when the DisableOwner parameter is passed as ‘True’. You can assign any form as the owner form.

The below code snippet will display the SplashPanel at the specified location with the owner form being disabled. The location will be effective only when the DesktopAlignment property is set as ‘Custom’.

Form2 f2 = new Form2();

// To display the SplashPanel call the ShowSplash() method.
this.splashPanel1.ShowSplash(new Point(100, 100), f2, true);
Private f2 As Form2 = New Form2

' To display the SplashPanel call the ShowSplash() method.
Me.splashPanel1.ShowSplash(New Point(100,100), f2, True)
  • HideSplash() - The SplashPanel can be hidden by calling this method at run time.
// To hide the SplashPanel call the HideSplash() method.
this.splashPanel1.HideSplash();
' To hide the SplashPanel call the HideSplash() method.
Me.splashPanel1.HideSplash()
  • ShowSplashDialog() -The method is used to display the SplashPanel as a modal dialog during run time.

When this method is called, the user will not be able to interact with the application until the SplashPanel is closed. This is the only difference between the ShowSplash() method and this method.

The parameters discussed for the method are as follows.

Parameters Table

Parameters Description
OwnerForm Represents the owner form.
Location Specifies the location at which the SplashPanel will be displayed.

The SplashPanel will be displayed at the position / location specified in this method. By passing a new instance of the owner form to this method, we can display the SplashPanel as a modal dialog.

The below example uses a button click event to call this method. This method is overloaded.

private void button1_Click(object sender, EventArgs e)
{
    this.splashPanel1.ShowDialogSplash(new Point(700, 700), new Form1());
}
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
Me.splashPanel1.ShowDialogSplash(New Point(700, 700), New Form1())
End Sub

This overloaded method passes the owner form as a parameter to this method.

private void button1_Click(object sender, EventArgs e)
{
    this.splashPanel1.ShowDialogSplash(new Form1());
}
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
Me.splashPanel1.ShowDialogSplash(New Form1())
End Sub
  • IsShowing() - This method will tell you whether the SplashPanel is currently displayed or not. This method returns ‘True’ if the SplashPanel is displayed and ‘False’ if it is not displayed.

You can call this method in a button click event and view the result in the output window as given below.

// To know whether splash screen is showing
private void button1_Click_1(object sender, EventArgs e)
{
    this.splashPanel1.IsShowing();
    Console.Write(this.splashPanel1.IsShowing());
}
' To know whether splash screen is showing
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
Me.splashPanel1.IsShowing()
Console.Write(Me.splashPanel1.IsShowing())
End Sub

Location

The location for displaying the splash window is specified using the property given below.

Property Table

SplashPanel Property Description
DiscreetLocation Gets / sets the location to display the splash window.

A Sample which demonstrates the ShowSplash() and ShowSplashDialog() methods is available in the below sample installation path.

…\My Documents\Syncfusion\EssentialStudio\Version Number\Windows\Tools.Windows\Samples\Advanced Editor Functions\ActionGroupingDemo

SplashPanel in TaskBar

The SplashPanel can be displayed in the taskbar and it’s appearance can be customized using the properties given below.

Property Table

SplashPanel Property Description
ShowInTaskBar Specifies if the SplashPanel is to be shown in the taskbar.
FormIcon Gets / sets the icon for the SplashPanel.
Text Specifies the text when displayed in the taskbar.
this.splashPanel1.ShowInTaskbar = true;
this.splashControl1.FormIcon = ((System.Drawing.Icon)(resources.GetObject("splashControl1.FormIcon")));
this.splashPanel1.Text = "Splash Panel";
Me.splashPanel1.ShowInTaskbar = true
Me.splashControl1.FormIcon = DirectCast((resources.GetObject("splashControl1.FormIcon")), System.Drawing.Icon)
Me.splashPanel1.Text = "Splash Panel"

Overview_img50

Time interval

The SplashPanel is, by default, a timed display splash screen. The SplashPanel uses internally, a System.Windows.Forms.Timer, to automatically close the splash screen after the set interval is elapsed. This behavior can be changed by setting the TimerInterval property to -1.

Property Table

SplashPanel Property Description
TimerInterval The time interval for which the splash screen should be displayed (in milliseconds).

The splash screen will be displayed for a specific time period and will then be closed.

this.splashPanel1.TimerInterval = 7000;
Me.splashPanel1.TimerInterval = 7000

Behavior settings

The user will not be able to close or resize the splash image, which is displayed during run time, normally. But by setting certain properties of the SplashPanel, the user can alter the SplashPanel. These properties are explained below in detail.

Property Table

SplashPanel Property Description
AllowMove Indicates whether the SplashPanel can be moved by the user at run time.
AllowResize Indicates whether the SplashPanel can be resized by the user at run time.
CloseOnClick Indicates whether the SplashPanel gets closed when the user clicks on it.

When the AllowMove property is set to ‘True’, the user will be allowed to click within the SplashPanel and move the SplashPanel on the screen.

When the AllowResize property is set to ‘True’, resize handles will be displayed when the user moves the mouse near the border of the SplashPanel.

NOTE

In the above cases, the splash panel will not be closed, until the host form is closed.

The user can also close the SplashPanel by a single mouse click. This feature can be enabled by setting the CloseOnClick property to ‘True’.

this.splashPanel1.AllowMove = true;
this.splashPanel1.AllowResize = true;
this.splashPanel1.CloseOnClick = true;
Me.splashPanel1.AllowMove = True
Me.splashPanel1.AllowResize = True
Me.splashPanel1.CloseOnClick = True