Notes
- Write the markup straight into
Caption — bold, colors, links — and the control parses and draws it.
- Clicking a link fires
OnHyperLinkClick with the link target, which you can use to open a page or run an action.
HyperLinkFontHotColor is the hover color for links; HyperLinkMouseButtons limits which mouse buttons activate them.
- Turn on
WordWrap to wrap long text to the label width (CJK by character, Latin by word) for multi-line descriptions.
Example
From the demo MlSkin.Demo.HtmlLabel&TMlSkinPopupMessage功能演示.v4.x (.dfm form file)
object mlsknhtmlbl1: TMlSkinHtmlLabel
Left = 18
Top = 248
Width = 632
Height = 433
AutoInvalidate = True
Alpha = 0
AutoSize = False
Caption = 'TMlSkinHtmlLabel'
Anchors = [akLeft, akTop, akRight, akBottom]
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Style = []
ParentFont = False
OnHyperLinkClick = mlsknhtmlbl1HyperLinkClick
end
Properties 11
| Name | Type | Default | Description |
|---|
Alpha | Byte | 192 | Opacity: 0 fully transparent, 255 opaque. |
AlignmentHorizontal | TAlignment | taLeftJustify | Horizontal text alignment: left, centred or right. |
AlignmentVertical | TVerticalAlignment | taAlignTop | Vertical text alignment: top, centred or bottom. |
AutoSize | Boolean | True | Whether the control resizes itself to fit its content. |
RoundBackground | Boolean | False | Draws the background with rounded corners; combined with Color it gives a tag-style text block. |
RoundSize | Integer | 5 | Corner radius in pixels; 0 means square corners. |
Color | TColor | clWhite | Background color of the control; ignored while Transparent is on. |
HyperLinkMouseButtons | TMlSkinHTLabelMouseButtons | — | Which mouse buttons activate a hyperlink — left, right, middle, in any combination. |
HyperLinkFontHotColor | TColor | clRed | Text color of a hyperlink while the mouse is over it. |
HyperLinkFontColor | TColor | clBlue | Hyperlink color when not hovered, blue by default; the hover color is HyperLinkFontHotColor. |
WordWrap | Boolean | False | Wraps text that is wider than the label: CJK text between characters, Latin text at spaces; <br> still forces a break. Vertical centring and hyperlink hit-testing follow the wrapped layout. Off by default. |
Events 1
| Name | Type | Default | Description |
|---|
OnHyperLinkClick | TMlSkinHyperLinkClickEvent | — | Fires when a hyperlink is clicked; the handler receives the link target so it can open a page or run an action. |
Events of TMlSkinCustomPanel 1
| Name | Type | Default | Description |
|---|
OnCustomDraw | TMlCustomDrawEvent | — | Custom draw event: paint your own content after the control has drawn itself. |
Properties of TMlSkinCustomControl 4
| Name | Type | Default | Description |
|---|
About | TMlAboutInfo | — | A design-time property: double-clicking it in the Object Inspector opens the MLSkin about box with the component version. It has no effect at run time and is not stored in the .dfm. |
Transparent | Boolean | True | Transparent background: the control skips its own fill and shows the form background (image or color) instead. |
AutoInvalidate | Boolean | False | Repaints automatically when the content changes. Turn it on if property changes do not show up. |
EraseBackground | Boolean | False | Whether the background is erased before painting; worth toggling if the control flickers. |
Events of TMlSkinCustomControl 4
| Name | Type | Default | Description |
|---|
OnDPIChanged | TMlDPIChangedEvent | — | Fires when the screen DPI changes, for example when the window moves to a monitor with a different scaling — a good place to re-adjust anything you draw yourself. |
OnBackgroundChanging | TMlBackgroundEvent | — | Fires just before the background changes, giving you a chance to adjust what is drawn. |
OnBackgroundChanged | TMlCustomDrawEvent | — | Fires after the background has been drawn, so you can paint on top of it. |
OnVisibleChanged | TNotifyEvent | — | Fires when the control is shown or hidden. |
Only the properties and events MLSkin adds are listed here. Standard VCL properties such as Align, Anchors, Font and OnClick are available too and behave exactly as on the stock controls.