- BeforeSplash event
- SplashDisplayed event
- SplashClosing event
- SplashClosed event
Contact Support
SplashControl Events in Windows Forms Splash Screen (Splash)
29 Apr 20219 minutes to read
The list of events and a detailed explanation about each of them is given in the following sections.
Events Table
SplashControl Events | Description |
---|---|
BeforeSplash | This event is raised before the splash screen is displayed. |
SplashDisplayed | This event is raised after the splash screen is displayed. |
SplashClosing | This event is raised before the SplashControl is closed. |
SplashClosed | This event is raised when the splash window is closed. |
Follow the below steps and use the corresponding events to get the results.
- Create a SplashControl and a TextBox in a form.
- Set the textbox properties and add the textbox to the form as given below.
// Declare the controls.
private Syncfusion.Windows.Forms.Tools.SplashControl splashControl1;
private System.Windows.Forms.TextBox textBox1;
// Initialize the controls.
this.splashControl1 = new Syncfusion.Windows.Forms.Tools.SplashControl();
this.textBox1 = new System.Windows.Forms.TextBox();
// Set the properties for the textbox.
this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.textBox1.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(103)), ((System.Byte)(110)), ((System.Byte)(154)));
this.textBox1.Location = new System.Drawing.Point(0, 0);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.textBox1.Size = new System.Drawing.Size(248, 206);
this.textBox1.TabIndex = 4;
this.textBox1.Text = "";
// Add the textbox to the form.
this.Controls.Add(Me.textBox1)
' Declare the textbox.
Friend WithEvents textBox1 As System.Windows.Forms.TextBox
' Initialize the textbox.
Me.textBox1 = New System.Windows.Forms.TextBox
' Set the properties for the textbox.
Me.textBox1.Dock = System.Windows.Forms.DockStyle.Fill
Me.textBox1.ForeColor = System.Drawing.Color.FromArgb(CType(103, Byte), CType(110, Byte), CType(154, Byte))
Me.textBox1.Location = New System.Drawing.Point(0, 0)
Me.textBox1.Multiline = True
Me.textBox1.Name = "textBox1"
Me.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
Me.textBox1.Size = New System.Drawing.Size(292, 266)
Me.textBox1.TabIndex = 5
Me.textBox1.Text = ""
' Add the textbox to the form.
Me.Controls.Add(this.textBox1);
BeforeSplash event
You can handle the BeforeSplash event to process any code just before the splash screen is displayed. For example in the below code, the event logs are recorded and displayed in the textbox.
Event data
The event handler receives an argument of type CancelEventArgs containing data related to this event. The following CancelEventArgs member provides information specific to this event.
Member Table
Member | Description |
---|---|
Cancel | Indicates whether the event should be canceled. |
// Handle the BeforeSplash event.
this.splashControl1.BeforeSplash += new System.ComponentModel.CancelEventHandler(this.splashControl1_BeforeSplash);
private void splashControl1_BeforeSplash(object sender, System.ComponentModel.CancelEventArgs e)
{
string eventlogmessage = String.Format("Event: {0} Object: {1}\r\n", "BeforeSplash", sender.ToString());
textBox1.Text = textBox1.Text + eventlogmessage;
// To cancel this event, give the below code.
e.Cancel = true;
}
' Handle the BeforeSplash event.
AddHandler Me.splashControl1.BeforeSplash, AddressOf Me.splashControl1_BeforeSplash
Private Sub splashControl1_BeforeSplash(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles splashControl1.BeforeSplash
Dim eventlogmessage As String = String.Format("Event: {0} Object: {1}" & Constants.vbCrLf, "BeforeSplash", sender.ToString())
textBox1.Text = textBox1.Text & eventlogmessage
' To cancel this event, give the below code.
e.Cancel = True
End Sub
BeforeSplash event is raised when the BeforeSplashNotify() method is called. This method is an implementation of the ISplashWrapperFormListener for receiving notification from the SplashWrapperForm before the splash window is displayed.
this.splashPanel1.BeforeSplashNotify();
Me.splashPanel1.BeforeSplashNotify()
SplashDisplayed event
The SplashDisplayed event is raised after the splash screen is displayed on the screen. For example in the below code, the event logs are recorded and displayed in a textbox.
// Handle the SplashDisplayed event.
this.splashControl1.SplashDisplayed += new System.EventHandler(this.splashControl1_SplashDisplayed);
private void splashControl1_SplashDisplayed(object sender, System.EventArgs e)
{
string eventlogmessage = String.Format("Event: {0} Object: {1}\r\n", "SplashDisplayed", sender.ToString());
textBox1.Text = textBox1.Text + eventlogmessage;
}
' Handle the SplashDisplayed event.
AddHandler Me.splashControl1.SplashDisplayed, AddressOf Me.splashControl1_SplashDisplayed
Private Sub splashControl1_SplashDisplayed(ByVal sender As Object, ByVal e As System.EventArgs) Handles splashControl1.SplashDisplayed
Dim eventlogmessage As String = String.Format("Event: {0} Object: {1}" & Constants.vbCrLf, "SplashDisplayed", sender.ToString())
textBox1.Text = textBox1.Text & eventlogmessage
End Sub
SplashDisplayed event will be triggered when the SplashDisplayedNotify() method is called. This method is an implementation of the ISplashWrapperFormListener for receiving notification from the SplashWrapperForm when the splash window is displayed.
this.splashPanel1.SplashDisplayedNotify();
Me.splashPanel1.SplashDisplayedNotify()
SplashClosing event
The SplashClosing event is raised when the splash screen is closing. For example in the below code, the event logs are recorded and displayed in a textbox.
// Handle the SplashClosing event.
this.splashControl1.SplashClosing +=new CancelEventHandler(splashControl1_SplashClosing);
private void splashControl1_SplashClosing(object sender, System.ComponentModel.CancelEventArgs e)
{
string eventlogmessage = String.Format("Event: {0} Object: {1}\r\n", "SplashClosing", sender.ToString());
textBox1.Text = textBox1.Text + eventlogmessage;
}
' Handle the SplashClosing event.
AddHandler Me.splashControl1.SplashClosing, AddressOf splashControl1_SplashClosing
Private Sub splashControl1_SplashClosing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles splashControl1.SplashClosing
Dim eventlogmessage As String = String.Format("Event: {0} Object: {1}" & Constants.vbCrLf, "SplashClosing", sender.ToString())
textBox1.Text = textBox1.Text & eventlogmessage
End Sub
SplashClosing event is raised when the SplashClosingNotify() method is called. This method is an implementation of the ISplashWrapperFormListener for receiving notification from the SplashWrapperForm when the splash window is closing.
this.splashControl1.SplashClosingNotify();
Me.splashControl1.SplashClosingNotify()
SplashClosed event
The SplashClosed event is raised after the splash screen is closed. For example in the below code, the event logs are recorded and displayed in a textbox.
// Handle the SplashClosed event.
this.splashControl1.SplashClosed += new System.EventHandler(this.splashControl1_SplashClosed);
private void splashControl1_SplashClosed(object sender, System.EventArgs e)
{
string eventlogmessage = String.Format("Event: {0} Object: {1}\r\n", "SplashClosed", sender.ToString());
textBox1.Text = textBox1.Text + eventlogmessage;
}
' Handle the SplashClosed event.
AddHandler Me.splashControl1.SplashClosed, AddressOf Me.splashControl1_SplashClosed
Private Sub splashControl1_SplashClosed(ByVal sender As Object, ByVal e As System.EventArgs) Handles splashControl1.SplashClosed
Dim eventlogmessage As String = String.Format("Event: {0} Object: {1}" & Constants.vbCrLf, "SplashClosed", sender.ToString())
textBox1.Text = textBox1.Text & eventlogmessage
End Sub
SplashClosed event is raised when the SplashClosedNotify() method is called. This method is an implementation of the ISplashWrapperFormListener for receiving notification from the SplashWrapperForm when the splash window is closed.
this.splashPanel1.SplashClosedNotify();
Me.splashPanel1.SplashClosedNotify()