TMlSkinToolbar
A redesigned toolbar that runs horizontally or vertically. Each button can carry an icon, a caption and a dropdown menu, and it is often used as a tab-style navigation bar.
Notes
- Buttons live in the
Itemscollection; each one has its caption, image index, kind (button, separator and so on) and enabled state. - Icons come either from
Images(a standard ImageList) or fromButtonImage(a multi-state picture). - Button size is set by
ButtonWidthandButtonHeight; withAutoButtonWidthon, width follows the caption andMaxButtonWidthcaps it. - When the buttons do not fit, scroll buttons appear:
ScrollButtonVisibleshows or hides them andScrollSizesets their size. - The background can be a color with transparency (
Alpha) or an image (BackgroundImage) laid out byBackgroundFillType. - Clicking a button fires
OnItemClick, which receives the clicked item.
Example
From the demo MlSkin.Demo.360云盘.v3.0 (.dfm form file)
object mlskntlbr1: TMlSkinToolbar
Left = 0
Top = 0
Width = 201
Height = 586
Color = 16644854
Items = <
...
Properties 28
| Name | Type | Default | Description |
|---|---|---|---|
AllowArrowKeys | Boolean | False | Whether the arrow keys move focus between the buttons. |
AutoButtonWidth | Boolean | False | Whether button width follows the caption length; with it off every button uses ButtonWidth. |
DelayRefresh | Boolean | False | Delays repainting, which cuts down redraws while a batch of buttons is being changed. |
TextOffset | TMlBtnItemOffset | — | Offset (X, Y) of the button captions. |
Items | TMlSkinToolbarItems | — | The buttons on the toolbar. Each item has its caption, image indexes (normal, hot, down, disabled), kind, enabled and down state, and an optional Action. |
Images | TCustomImageList | — | The ImageList the button icons come from; the image indexes on each item point into it. |
ButtonImage | TPngPictures | — | The button background as a multi-state image, covering the normal, hot and pressed states. |
ButtonWidth | Integer | 48 | Button width in pixels. |
MaxButtonWidth | Integer | 0 | Maximum button width in pixels; 0 means unlimited. Use it with AutoButtonWidth to stop buttons growing too wide. |
ButtonHeight | Integer | 48 | Button height in pixels. |
SpaceSize | Integer | 3 | Gap between buttons in pixels. |
MultiLine | Boolean | False | Whether buttons wrap to a second row when they do not fit. |
DropdownMenuOffset | TMlBtnItemOffset | — | Offset (X, Y) applied to where the dropdown menu pops up. |
ScrollSize | Integer | 15 | Size in pixels of the scroll buttons at each end. |
ScrollButtonVisible | Boolean | True | Whether the scroll buttons appear at the ends when the buttons overflow. |
MarginSize | Integer | 20 | Padding in pixels between the toolbar content and its edges. |
MarginTextSize | Integer | 2 | Gap in pixels between an icon and its caption. |
PressedOffset | Integer | 0 | How many pixels the button content shifts while pressed. |
Alpha | Byte | 192 | Opacity of the toolbar background: 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. |
BackgroundImage | TMlResID | — | Background image of the toolbar, given as an image ID or path. |
BackgroundFillType | TMlPngFillType | ftNormal | How the background image is laid out: as-is, tiled, auto-stretched, centred, stretched or gradient. |
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. |
FontHot | TFont | — | Font used while the mouse is over the control. |
FontDown | TFont | — | Font used while the control is pressed. |
Events 5
| Name | Type | Default | Description |
|---|---|---|---|
OnItemClick | TToolbarClickEvent | — | Fires when a button is clicked; the clicked item is passed to the handler. |
OnItemDown | TToolbarClickEvent | — | Fires when a button goes down, before the click completes. |
OnItemFocusChanged | TNotifyEvent | — | Fires when focus moves from one button to another. |
OnDrawItem | TMlToolbarItemDrawEnvent | — | Owner-draw event for painting an individual item yourself. |
OnButtonWidthChanged | TToolbarButtonWidthEvent | — | Fires after a button's width changes, mostly when AutoButtonWidth is on. |
Properties of TMlSkinCustomPanel 1
| Name | Type | Default | Description |
|---|---|---|---|
Color | TColor | clWhite | Background color of the control; ignored while Transparent is on. |
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 5
| 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. |
Color | TColor | clWhite | Background color of the control; ignored while Transparent is on. |
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.
Offline helpA PDF / CHM version is available for offline reading.