The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....

Using THtmlLab

The THtmlLab component provides a simple solution to a common problem. If you want to display labels with subscripts, or different fonts or colors, THmtlLab may be the right component. The properties of the label text can be controlled by inserting simple HTML statements into the text. These statements form a small subset of the common HTML tags:

HTML Tag Explanation Sample HTML Code Rendered Text
<b> Bold text <b>bold</b> and normal bold and normal
<font> Font properties;
supported are color,
size, and face
<font color=#FF2968>colored</font> text colored text
<font size=14>larger</font> text larger text
<font face=Courier>teletype</font> text teletype text
<i> Italic font <i>italic</i> font italic font
<s> Strikeout font <s>strikeout</s> font strikeout font
<sub> Subscripts. x<sub>1</sub> x1
<sup> Superscripts n<sup>3</sup> n3
<u> Underlined text. <u>under</u>lined underlined

By default, the color of the text, its size, and the font is controlled by the property Font. Further, the properties ColorBkg and Transparent control the background color and the transparency of the label. The FrameStyle property determines the frame around the label.

The HTML code is checked for validity during parsing the Caption text. In the case of an invalid HTML code, an exception is generated. However, the exceptions can be suppressed by setting the property SuppressExceptions to TRUE.

Last Update: 2023-Feb-06