Notes
- The chips live in the
Items collection, each with its caption, colors and enabled state.
DeleteButton styles the delete button on a chip; clicking it fires OnDeleteClick.
- Chip size is tuned with
ItemHeight, ItemMinWidth and ItemSpaceSize.
- Clicking a chip fires
OnClickItem; use OnDrawItem to paint the chips yourself.
Example
From the demo MlSkin.Demo.标记框(Tags) (.dfm form file)
object MlSkinTagsBox1: TMlSkinTagsBox
Left = 8
Top = 41
Width = 424
Height = 152
Transparent = False
RoundRadius = 14
DeleteButton.Visible = False
Items = <
...
Properties 18
| Name | Type | Default | Description |
|---|
RoundRadius | Integer | 12 | Corner radius of the chips, in pixels. |
DeleteButton | TMlSkinColorControls_DeleteButton | — | The delete button on a chip: its image, size and visibility. Clicking it fires OnDeleteClick. |
Items | TMlTagsBoxItems | — | The chip collection; each entry has a caption, colors, enabled and visible flags. |
ItemMinWidth | Integer | 60 | Minimum width of a chip in pixels. |
ItemHeight | Integer | 25 | Chip height in pixels. |
ItemSpaceSize | Integer | 10 | Gap between chips in pixels. |
MarginBorderSize | Integer | 10 | Padding between the chip area and the control edge, in pixels. |
ScrollSize | Integer | 30 | Width of the scrollbar in pixels. |
HideScrollbar | Boolean | False | Hides the scrollbar while the content still scrolls. |
Alpha | Byte | 192 | Opacity: 0 fully transparent, 255 opaque. |
BorderSides | TSides | — | Which border edges are drawn — any combination of top, bottom, left and right. |
BorderColor | TColor | $00D9CBBA | Border color. |
Color | TColor | clWhite | Background color of the control; ignored while Transparent is on. |
BackgroundFillType | TMlPngFillType | ftNormal | How the background image is laid out: ftNormal as-is, ftTile tiled, ftAutoStretch auto-stretched, ftCenter centred, ftStretch stretched to fill, ftGradient gradient. |
BackgroundImage | TMlResID | — | Background image, given as a resource ID or an image file path. |
BackgroundOffsetX | Integer | 0 | Horizontal offset of the background image in pixels. |
BackgroundOffsetY | Integer | 0 | Vertical offset of the background image in pixels. |
DoubleBorder | Boolean | True | Double border: draws a second line inside the border. |
Events 7
| Name | Type | Default | Description |
|---|
OnClickItem | TItem | — | Fires when a chip is clicked. |
OnDrawItem | TMlTagsBoxItemDrawEnvent | — | Fires while a chip is drawn, so you can style it yourself. |
OnDeleteClick | TItemDeleteEvent | — | Fires when a chip's delete button is clicked; this is usually where you remove the entry from Items. |
OnGetCursor | TMlGetCursorEvent | — | Fires while the cursor is being chosen, so different areas can return different cursors. |
OnHotChanged | TItemHot | — | Fires when the chip under the mouse changes. |
OnFocusChanging | TStateChange | — | Fires just before the focused chip changes. |
OnChanged | TNotifyEvent | — | Fires after the state or value has changed. |
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.