Telerik blogs

Until recently our Windows Forms offering didn’t have support for HTML-like rich text formatting, so typical for web applications. With the Q3 release shipped on November 5 this has changed.

This release of RadControls for WinForms has the HTML-like formatting capabilities on a framework level. What does it mean? Well, as of now every VisualElement descendent is capable of rich text formatting - Labels, Buttons, RadCalendar, RadGridView, etc. The implementation is very simple, especially if your users are familiar with HTML. To turn on the rich formatting behavior you must begin your text with an <html> tag; use <size=[+|-]value> to set the font size used, and <br> to create a new line feed. To bold, underline and italic text styles, use the corresponding opening and closing tags (<i>, <b>, <u>). Font family is set through <font=Family> tag.

For example, to switch the Button’s text from “Check Mail” to bolded and italic “Check Mail” formatting, you should change the text from “Check Mail” to “<HTML><b>Check</b> <i>Mail</i>”.

 

“Check Mail” to rich text “Check Mail”

 

Here are the Label, Chekbox, ComboBox, Buttons, and ListBox WinForms controls with HTML-like formatting:

21

22

Since this feature is embedded in our framework (TPF), you can also use it in more advanced controls, such as the new RadScheduler and RadGridView. In RadGridView you can use rich-text for the column headers and the actual data cells. To style RadGridView Columns:

this.radGridView1.Columns["City"].FormatString = "<html><b>City</b>: {0}"; //City will be bold

this.radGridView1.Columns["ContactName"].FormatString = "<html><Color=red>Name:</b><Color=green> {0}"; //Name will be Red and value will be Green

this.radGridView1.Columns["Phone"].FormatString = "<html># <u>{0}"; //underline only the number
 

Rich-format RadGridView Columns


Using this functionality, users can easily add rich text formatting to their applications. No RTL support is available at the moment.

What do you think of adding flipping (vertical and rotated ) text capabilities? Will you consider using such feature?


About the Author

Nikolay Diyanov

Diyanov is the Product Manager of the Native Mobile UI division at Progress. Delivering outstanding solutions that make developers' lives easier is his passion and the biggest reward in his work. In his spare time, Nikolay enjoys travelling around the world, hiking, sun-bathing and kite-surfing.

Find him on Twitter @n_diyanov or on LinkedIn.

Related Posts

Comments

Comments are disabled in preview mode.