New to Telerik UI for WinFormsStart a free 30-day trial

HTML-like Text Formatting

Updated over 6 months ago

Introduction

Telerik UI for WinForms provide an advanced text styling mechanism, which can be applied to all Telerik products, because it enhances the smallest element in the Telerik Presentation Framework - the text primitive. The new rich text formatting mechanism uses plain HTML tags to display formatted text such as font style, font color, font size options and simple layouts. To turn on Html-like formatting the text must start with an <html> tag; use <size=[+|-]value> to set font size use, and <br> to create new line feed. To bold, underline and italic text, use the corresponding opening and closing tags. Font family is set through <font=Family>.

Supported Tags 

TagEnd TagDescription
<font>N/ASpecifies the font family
<color>N/ASpecifies the text color.
<size>N/ASpecifies the font size.
<b></b>Defines bold text.
<i></i>Defines italic text.
<u></u>Defines underlined text.
<br>N/ASingle line break.
<a></a>Defines a hyperlink

Example

The following code snippet will produce the result shown in the screen-shot below:

Set HTML-like text formatting to RadLabel text

C#
this.radLabel1.Text = "<html><size=12>This is RadLabel <br><b><font=Arial>Arial, Bold</b><br><i><color= Red><font=Times New Roman>Times, Italic <u>Underline</u><br><size=9>Size = 9<br><color= 0, 0, 255>Sample Text";

Figure 1: HTML-like Text

WinForms RadLabel HTML-like Text

See Also