)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to handle HTML Element events in WinForms HTMLUIControl?

Platform: WinForms |
Control: HTMLUIControl |
Published Date: April 30, 2011 |
Last Revised Date: January 3, 2020

Handle HTML element

The HTML elements in HTMLUI can handle the common element events like Click, DoubleClick, Mouse events, Keyboard events, etc.

C#

htmlelements = this.htmluiControl1.Document.GetElementsByUserIdHash();
this.text1Element = htmlelements["Text1"] as BaseElement;
this.radio1Element = htmlelements["Radio1"] as BaseElement;
this.checkBox1Element = htmlelements["CheckBox1"] as BaseElement;
this.image1Element = htmlelements["Image1"] as BaseElement;
this.button1Element = htmlelements["Button1"] as BaseElement;
this.outputCellElement = htmlelements["outputCell"] as BaseElement;
this.text1Element.Click += new EventHandler( element_Click );
this.text1Element.DoubleClick += new EventHandler( element_DoubleClick );
this.text1Element.KeyDown += new EventHandler( element_KeyDown );
this.text1Element.KeyPress += new EventHandler( element_KeyPress );
this.text1Element.KeyUp += new EventHandler( element_KeyUp );
this.text1Element.MouseDown += new EventHandler( element_MouseDown );
this.text1Element.MouseEnter += new EventHandler( element_MouseEnter );
this.text1Element.MouseLeave += new EventHandler( element_MouseLeave );
this.text1Element.MouseMove += new EventHandler( element_MouseMove );

 

VB

htmlelements = Me.htmluiControl1.Document.GetElementsByUserIdHash()
Me.text1Element = htmlelements("Text1")
Me.radio1Element = htmlelements("Radio1")
Me.checkBox1Element = htmlelements("CheckBox1")
Me.image1Element = htmlelements("Image1")
Me.button1Element = htmlelements("Button1")
Me.outputCellElement = htmlelements("outputCell")
AddHandler Me.text1Element.Click, AddressOf element_Click
AddHandler Me.text1Element.DoubleClick, AddressOf element_DoubleClick
AddHandler Me.text1Element.KeyDown, AddressOf element_KeyDown
AddHandler Me.text1Element.KeyPress, AddressOf element_KeyPress
AddHandler Me.text1Element.KeyUp, AddressOf element_KeyUp
AddHandler Me.text1Element.MouseDown, AddressOf element_MouseDown
AddHandler Me.text1Element.MouseEnter, AddressOf element_MouseEnter
AddHandler Me.text1Element.MouseLeave, AddressOf element_MouseLeave
AddHandler Me.text1Element.MouseMove, AddressOf element_MouseMove

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

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon