New to Telerik UI for WinForms? Start a free 30-day trial

Parses the supported lightweight HTML-like markup used by text primitives into formatted text blocks.

Definition

Namespace:Telerik.WinControls.TextPrimitiveUtils

Assembly:Telerik.WinControls.dll

Syntax:

C#
public class TinyHTMLParsers

Inheritance: objectTinyHTMLParsers

Constructors

C#
public TinyHTMLParsers()

Properties

Gets or sets the color used to display a visited hyperlink.

C#
public static Color LinkClickedColor { get; set; }

Gets or sets the color used to display a non-visited hyperlink.

C#
public static Color LinkColor { get; set; }

Methods

Parse single HTML tag and apply settings

C#
public static bool ApplyHTMLSettingsFromTag(ref FormattedText currentFormattedText, FormattedText prevText, string htmlTag, TinyHTMLParsers.TinyHTMLParsersData parserData, ref bool shouldProduceNewLine, ref string text)
Parameters:currentFormattedTextFormattedTextprevTextFormattedTexthtmlTagstringparserDataTinyHTMLParsers.TinyHTMLParsersDatashouldProduceNewLinebooltextstringReturns:

bool

Determines whether the text is long enough and begins with the case-insensitive <HTML> prefix.

C#
public static bool IsHTMLMode(string text)
Parameters:textstring

The text to inspect.

Returns:

bool

true if the prefix is present and the text has at least seven characters; otherwise, false.

Main function for parsing process

C#
public static FormattedTextBlock Parse(string text, Color baseForeColor, string baseFont, float fontSize, ContentAlignment aligment)
Parameters:textstring

text to parse

baseForeColorColor

base Font color

baseFontstring

base font

fontSizefloat

base font size

aligmentContentAlignment

base textaligment

Returns:

FormattedTextBlock

Formatted text block that contains the whole structure

Main function for parsing process

C#
public static FormattedTextBlock Parse(string text, Color baseForeColor, string baseFont, float fontSize, FontStyle fontStyle, ContentAlignment aligment)
Parameters:textstring

text to parse

baseForeColorColor

base Font color

baseFontstring

base font

fontSizefloat

base font size

fontStyleFontStyle

base font style etc. Regular, Bold

aligmentContentAlignment

base textaligment

Returns:

FormattedTextBlock

Formatted text block that contains the whole structure

Parses text using the content, color, font, size, style, and alignment from the supplied parameters.

C#
public static FormattedTextBlock Parse(TextParams textParams)
Parameters:textParamsTextParams

The text and base formatting settings for the parsed block.

Returns:

FormattedTextBlock

A formatted block containing the parsed text segments and lines.