Articles in this section
Category / Section

How to create an interface between the custom control elements defined inside the HTML document and the WinForms control in the HTMLUIControl?

2 mins read

Custom controls

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.


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
    BaseElement maskedEditTextBoxElement1 = htmlelements["MaskedEditTextBox1"] as
    new CustomControlBase( maskedEditTextBoxElement1, this.maskedEditBox1 );
    BaseElement buttonElement = htmlelements["Button1"] as BaseElement;
    new CustomControlBase( buttonElement, this.button1 );



Private Sub htmluiControl1_PreRenderDocument(ByVal sender As Object, ByVal e As
    Dim htmlelements As Hashtable = New Hashtable()
    htmlelements = e.Document.ElementsByUserID
    'here the base functionality of the 'this.maskedEditBox1' is implemented to the
    Dim maskedEditTextBoxElement1 As BaseElement = CType(IIf(TypeOf
    htmlelements("MaskedEditTextBox1") Is BaseElement, htmlelements("MaskedEditTextBox1"),
Nothing), BaseElement)
    Dim oTemp As CustomControlBase = New CustomControlBase(maskedEditTextBoxElement1,
    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


Reference link:

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