Articles in this section
Category / Section

What are the events raised by the WinForms HTMLUIControl?

2 mins read

HTMLUI events

The following are the events raised by the HTMLUI control. These events are not only used in tracing the execution of the code but also used in generating custom rich user interfaces that improve the efficiency of the application.

i) LoadStarted Event

The Load started event is raised when a new HTML document starts loading.

C#

this.htmluiControl1.LoadStarted += new System.EventHandler(this.htmluiControl1_LoadStarted);
private void htmluiControl1_LoadStarted(object sender, System.EventArgs e)
{
    Console.WriteLine("Started Loading...");
}

 

VB

Private Me.htmluiControl1.LoadStarted += New System.EventHandler(Me.htmluiControl1_LoadStarted)
Private Sub htmluiControl1_LoadStarted(ByVal sender As Object, ByVal e As System.EventArgs)
    Console.WriteLine("Started Loading...")
End Sub

ii) LoadFinished Event

The LoadFinished event is raised after the HTML document is loaded into the HTMLUI control.

C#

this.htmluiControl1.LoadFinished += new System.EventHandler(this.htmluiControl1_LoadFinished);
private void htmluiControl1_LoadFinished(object sender, System.EventArgs e)
{
    Console.WriteLine("Load successfully completed");
}

 

VB

Private Me.htmluiControl1.LoadFinished += New System.EventHandler(Me.htmluiControl1_LoadFinished)
Private Sub htmluiControl1_LoadFinished(ByVal sender As Object, ByVal e As System.EventArgs)
    Console.WriteLine("Load successfully completed")
End Sub

iii) LoadError Event

The LoadError event occurs when the loading of the HTML document into the HTMLUI control fails. This event can be handled to provide any custom form of feedback to the end user.

C#

this.htmluiControl1.LoadError += new Syncfusion.Windows.Forms.HTMLUI.LoadErrorEventHandler(this.htmluiControl1_LoadError);
private void htmluiControl1_LoadError(object sender, Syncfusion.Windows.Forms.HTMLUI.LoadErrorEventArgs e)
{
     Console.WriteLine("Error loading due to"+ e.ToString());
}

 

VB

Private Me.htmluiControl1.LoadError += New Syncfusion.Windows.Forms.HTMLUI.LoadErrorEventHandler(Me.htmluiControl1_LoadError)
Private Sub htmluiControl1_LoadError(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.HTMLUI.LoadErrorEventArgs)
     Console.WriteLine("Error loading due to"+ e.ToString())
End Sub

iv) PrerenderDocument Event

The PrerenderDocument event is raised when the document has been created but the size and the location of the elements are not yet fixed.

C#

this.htmluiControl1.PreRenderDocument += new Syncfusion.Windows.Forms.HTMLUI.PreRenderDocumentEventHandler(this.htmluiControl1_PreRenderDocument);
private void htmluiControl1_PreRenderDocument(object sender, Syncfusion.Windows.Forms.HTMLUI.PreRenderDocumentArgs e)
{
     Console.WriteLine("This is the Prerender document event”);
}

 

VB

Me.htmluiControl1.PreRenderDocument += New Syncfusion.Windows.Forms.HTMLUI.PreRenderDocumentEventHandler(Me.htmluiControl1_PreRenderDocument)
Private Sub htmluiControl1_PreRenderDocument(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.HTMLUI.PreRenderDocumentArgs)
     Console.WriteLine("This is the Prerender document event”)
End Sub

v) LinkClicked Event

This event is raised after the Hyperlink is clicked and before the Hyperlink loads a new document into the HTMLUI control.

C#

this.htmluiControl1.LinkClicked += new Syncfusion.Windows.Forms.HTMLUI.LinkForwardEventHandler(this.htmluiControl1_LinkClicked);
private void htmluiControl1_LinkClicked(object sender, LinkForwardEventArgs e)
{
     MessageBox.Show("Link Clicked");
}

 

VB

Private Me.htmluiControl1.LinkClicked += New Syncfusion.Windows.Forms.HTMLUI.LinkForwardEventHandler(Me.htmluiControl1_LinkClicked)
Private Sub htmluiControl1_LinkClicked(ByVal sender As Object, ByVal e As LinkForwardEventArgs)
     MessageBox.Show("Link Clicked")
End Sub

vi) ShowTitleChanged Event

The ShowTitleChanged event is raised after the ShowTitle property of the HTMLUI control is changed. The ShowTitle is a boolean property that decides whether the title of the HTML document should be displayed or not.

C#

this.htmluiControl1.ShowTitleChanged += new Syncfusion.Windows.Forms.HTMLUI.ValueChangedEventHandler(this.htmluiControl1_ShowTitleChanged);
private void htmluiControl1_ShowTitleChanged(object sender, ValueChangedEventArgs e)
{
     MessageBox.Show("ShowTitle Changed");
}

 

VB

Private Me.htmluiControl1.ShowTitleChanged += New Syncfusion.Windows.Forms.HTMLUI.ValueChangedEventHandler(Me.htmluiControl1_ShowTitleChanged)
Private Sub htmluiControl1_ShowTitleChanged(ByVal sender As Object, ByVal e As ValueChangedEventArgs)
     MessageBox.Show("ShowTitle Changed")
End Sub

vii) TitleChanged

The TitleChanged event is raised after the Title property of the HTMLUI control is changed. The Title value can be set explicitly by the user or it can be extracted from the title tag of the HTML document that is to be loaded into the HTMLUI control.

C#

this.htmluiControl1.TitleChanged += new Syncfusion.Windows.Forms.HTMLUI.ValueChangedEventHandler(this.htmluiControl1_TitleChanged);
private void htmluiControl1_TitleChanged(object sender, ValueChangedEventArgs e)
{
     MessageBox.Show("Title Changed");
}

 

VB

Private Me.htmluiControl1.TitleChanged += New Syncfusion.Windows.Forms.HTMLUI.ValueChangedEventHandler(Me.htmluiControl1_TitleChanged)
Private Sub htmluiControl1_TitleChanged(ByVal sender As Object, ByVal e As ValueChangedEventArgs)
     MessageBox.Show("Title Changed")
End Sub

 

Reference link: https://help.syncfusion.com/windowsforms/html-viewer/control-events

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied