Notes
- Cell size comes from
ItemWidth and the inherited ItemHeight, with ItemSpaceSize between them.
AutoDrag lets the user drag icons to reorder them; ShakeInEdit wiggles the icons in edit mode to show they can be moved or removed.
MultiChecked allows selecting several icons at once.
- Clicking an icon fires
OnClickItem, and its delete button fires OnDeleteClick.
Example
From the demo MlSkin.Demo.按钮列表组件.v3.0 (.dfm form file)
object lst1: TMlSkinIconButtonList
Left = 14
Top = 48
Width = 361
Height = 369
Items = <>
Images = il1
ItemWidth = 60
ItemHeight = 80
ShakeInEdit = True
OnClickItem = lst1ClickItem
Anchors = [akLeft, akTop, akBottom]
end
Properties 24
| Name | Type | Default | Description |
|---|
AutoDrag | Boolean | True | Lets the user drag icons to reorder them. |
AlignWithItems | TMlItemHAlign | ihaLeft | Horizontal alignment of the items inside the control: ihaLeft, ihaCenter or ihaRight. |
CaptionVisible | Boolean | True | Whether the caption is drawn. Turn it off for icon-only buttons. |
CaptionWordWarp | Boolean | True | Whether the caption under an icon wraps to a second line. |
Items | TMlIconButtonItems | — | The control's collection of items, editable one by one in the Object Inspector. |
Images | TCustomImageList | — | The ImageList the icons come from. |
ItemWidth | Integer | — | Width of each item in pixels. |
ItemHeight | Integer | — | Height of each item in pixels. |
ItemSpaceSize | Integer | 10 | Gap between items in pixels. |
ItemHotImage | TMlResID | — | Background image shown while the mouse is over an icon. |
MarginBorderSize | Integer | 10 | Padding between the content and the control edge, in pixels. |
MultiChecked | Boolean | True | Allows several icons to be selected at once. |
ShakeInEdit | Boolean | False | Wiggles the icons in edit mode to show they can be dragged or deleted, like a phone home screen. |
ScrollSize | Integer | 30 | Width of the scrollbar in pixels. |
PressedOffset | Integer | 1 | How many pixels the content shifts down-right while pressed, giving the push-in effect; 0 means no shift. |
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. |
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 6
| Name | Type | Default | Description |
|---|
OnClickItem | TItem | — | Fires when an item is clicked. |
OnDrawItem | TMlIconButtonItemDrawEnvent | — | Fires while an item is drawn, so you can style it yourself. |
OnDeleteClick | TItemDeleteEvent | — | Fires when an item's delete button is clicked; this is usually where you remove it. |
OnGetCursor | TMlGetCursorEvent | — | Fires while the cursor is chosen, so different areas can use different cursors. |
OnHotChanged | TItemHot | — | Fires when the item under the mouse changes. |
OnFocusChanging | TStateChange | — | Fires just before the focused item changes. |
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.