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. Image for the cookie policy date

Formatting Custom Controls

I want to create some custom controls, that can be formatted using attributes and CSS.

How do I go about this ? Do I need to derive from a custom control base, or can I implement various interfaces that the HTMLUIControl will populate with the HTML Format?

I have experimented with implementing IHTMLFormat on my control but that doesn't seem to work.

Any advice appreciated.

3 Replies

RA Ramu Syncfusion Team April 27, 2007 05:41 PM UTC

Hi Dominic,

Please have a look at the shipped sample in [[Installed Drive]:\Program Files\Syncfusion\Essential Studio\4.4.0.51\Windows\HTMLUI.Windows\Samples\Custom Controls] and let me know if you have any queries.

In the sample, the custom controls can be defined with the help of user defined tags in htm file and can be interfaced with the controls that are available on the form with the help of the the prerenderdocument event

* The prerenderdocument event occurs at the time when the HTML document is being loaded into the HTMLUI control but, the elements have not yet been 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 in order to link the HTML elements that are stored in the hashtable with the help of the key that is associated with the element.

* The CustomControlBase is used to implement the base functionality of the Windows forms control on the HTML tag element.

I am working on implementing IHTMLFormat and will reply you in 24 hours.

Thank you for your interest in Syncfusion products.

Regards,
Ramu


RA Ramu Syncfusion Team April 28, 2007 08:44 AM UTC

Hi Dominic,

Here is the code snippet that will help you to format the custom control.

This code can be added to a new command button of above said program to change the cursor type to hand symbol for datagrid.

C# Code:

HTMLFormat formatOrange = new HTMLFormat("FormatOrange");
formatOrange.Cursor = Cursors.Hand;

BaseElement dataGridElement1 = this.htmluiControl1.Document.GetElementByUserId("dataGrid1") as BaseElement;

//To set format to the custom control.
dataGridElement1.Format = (IHTMLFormat)formatOrange;


Please let me know if you have any queries.

Thanks,
Ramu


DM Dominic Messenger May 1, 2007 10:11 PM UTC

Thanks for this.
I will take a look and let you know

Loader.
Live Chat Icon For mobile
Up arrow icon