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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How do I create an interface between the custom control elements defined inside the HTML document and the Windows forms control in the HTMLUI?

 

The custom controls defined in the HTML document are interfaced with their equivalent windows forms control with the help of the the PreRenderDocument event. The PreRenderDocument event occurs at a time when the HTML document is being loaded into the HTMLUI control but the elements are not yet positioned.

The HTML elements are loaded into an hashtable with an equivalent id as their key. An equivalent Base class object, here BaseElement class, is defined to link the HTML elements stored in the hashtable with the help of the key associated with the element. The BaseElement is the Base class for all HTML elements. All HTML tag elements inherit this class.

The CustomControlBase implements the base functionality of the Windows forms control on the HTML tag element.

C#

private void htmluiControl1_PreRenderDocument(object sender,

Syncfusion.Windows.Forms.HTMLUI.PreRenderDocumentArgs e)

{

Hashtable htmlelements = new Hashtable();

htmlelements = e.Document.ElementsByUserID;

//here the base functionality of the 'this.maskedEditBox1' is implemented to the

'maskedEditTextBoxElement1'

BaseElement maskedEditTextBoxElement1 = htmlelements["MaskedEditTextBox1"] as

BaseElement;

new CustomControlBase( maskedEditTextBoxElement1, this.maskedEditBox1 );

BaseElement buttonElement = htmlelements["Button1"] as BaseElement;

new CustomControlBase( buttonElement, this.button1 );

}

VB

Private Sub htmluiControl1_PreRenderDocument(ByVal sender As Object, ByVal e As

Syncfusion.Windows.Forms.HTMLUI.PreRenderDocumentArgs)

Dim htmlelements As Hashtable = New Hashtable()

htmlelements = e.Document.ElementsByUserID

'here the base functionality of the 'this.maskedEditBox1' is implemented to the

'maskedEditTextBoxElement1'

Dim maskedEditTextBoxElement1 As BaseElement = CType(IIf(TypeOf

htmlelements("MaskedEditTextBox1") Is BaseElement, htmlelements("MaskedEditTextBox1"),

Nothing), BaseElement)

Dim oTemp As CustomControlBase = New CustomControlBase(maskedEditTextBoxElement1,

Me.maskedEditBox1)

Dim buttonElement As BaseElement = CType(IIf(TypeOf htmlelements("Button1") Is BaseElement,

htmlelements("Button1"), Nothing), BaseElement)

Dim oTemp As CustomControlBase = New CustomControlBase(buttonElement, Me.button1)

End Sub

Article ID: Published Date: Last Revised Date: Platform: Control:
802 04/30/2011 07/10/2014 WinForms HTMLUIControl
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Please sign in to access our KB

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

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