The control supports simple HTML, known as mini html. That's just the basic HTML text formatting tags. It also includes word-wrapping for multi-line support.
Internally the control builds a list of actions that describe how to paint the text. This allows for the control to only parse the HTML text once and quickly repaint the control when needed.
HTML tag support
The following tags are supported:
<B>...</B>
The bold text format.
<I>...</I>
Formats text in italics.
<UL>...</UL>
Prints underlined text.
<FONT>...</FONT>
The font tag with several attributes, such as FACE="xyz", SIZE=n and COLOR="#rrggbb".
<BR>
A single line-break. Note that CR LF combinations are ignored.
<DIV>...</DIV>
A line-breaking text strip. Supports the following attribute: ALIGN="xyz".
The bold text format.
<I>...</I>
Formats text in italics.
<UL>...</UL>
Prints underlined text.
<FONT>...</FONT>
The font tag with several attributes, such as FACE="xyz", SIZE=n and COLOR="#rrggbb".
<BR>
A single line-break. Note that CR LF combinations are ignored.
<DIV>...</DIV>
A line-breaking text strip. Supports the following attribute: ALIGN="xyz".
How to use it
To use it, place aSTATIC
control (label) on your dialog.
Add a member variable to your dialog implementation file...
CMiniHtmlCtrl m_ctrlLabel
In the OnInitDialog()
event handler, add the following lines:
LRESULT OnInitDialog(UINT /*uMsg*/,
WPARAM /*wParam*/,
LPARAM /*lParam*/,
BOOL& /*bHandled*/)
{
...
m_ctrlLabel.SubclassWindow(GetDlgItem(IDC_LABEL));
m_ctrlLabel.SetWindowText("html stuff goes here...");
...
}
Source Code Dependencies
Microsoft Visual C++ 6.0Microsoft WTL 7.0 Library
See Also
A RTF based label control.Download Files
![]() | Source Code (6 Kb) |