Notes
- Unlike TMlSkinPageControl it only manages the strip itself, so it is usually paired with a TFrame or a set of panels for the content.
CloseButtonVisible shows the close button; clicking it fires OnCloseButtonClick, where you remove the tab and its content.
AllowDragTab lets the user drag tabs into a new order.
- Tab width comes from
ButtonWidth, or from the caption when AutoButtonWidth is on, capped by MaxButtonWidth.
Example
From the demo MlSkin.Demo.多页面切换(含关闭按钮 TMlSkinTabset+TFrame).v3.0 (.dfm form file)
object mltbs1: TMlSkinTabset
Left = 0
Top = 0
Width = 750
Height = 38
Color = clBlack
CloseButton.Active = True
CloseButton.Image = 'MlSkinMini_close_btn'
CloseButton.Normal = 0
CloseButton.Hot = 1
CloseButton.Disable = 0
CloseButton.Count = 2
CloseButton.Pressed = 1
CloseButtonVisible = True
OnCloseButtonClick = mltbs1CloseButtonClick
DelayRefresh = True
Items = <
...
Properties 28
| Name | Type | Default | Description |
|---|
AllowDragTab | Boolean | False | Lets the user drag tabs into a different order. |
AutoButtonWidth | Boolean | False | Whether tab width follows the caption length. |
CloseButton | TPngPictures | — | Images for the close button on a tab — normal, hot and pressed frames. |
CloseButtonVisible | Boolean | False | Whether the close button appears on the tabs. |
CloseButtonOffset | TMlOffset | — | Offset (X, Y) of the close button. |
DelayRefresh | Boolean | False | Delays repainting, cutting redraws while a batch of tabs is changed. |
TextOffset | TMlBtnItemOffset | — | Offset (X, Y) of the tab captions. |
Items | TMlSkinToolbarItems | — | The control's collection of items, editable one by one in the Object Inspector. |
Images | TCustomImageList | — | The ImageList the icons come from. |
ButtonImage | TPngPictures | — | Tab background images — normal, hot and selected frames. |
ButtonWidth | Integer | 48 | Tab width in pixels. |
MaxButtonWidth | Integer | 0 | Maximum tab width in pixels; 0 means unlimited. |
ButtonHeight | Integer | 48 | Tab height in pixels. |
SpaceSize | Integer | 3 | Gap between tabs in pixels. |
MultiLine | Boolean | False | Whether tabs wrap to another row when they do not fit. |
ScrollSize | Integer | 15 | Width of the scrollbar in pixels. |
MarginSize | Integer | 20 | Padding between the tab strip content and its edges, in pixels. |
MarginTextSize | Integer | 2 | Gap between a tab's icon and its caption, in pixels. |
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. |
BackgroundImage | TMlResID | — | Background image, given as a resource ID or an image file path. |
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. |
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 7
| Name | Type | Default | Description |
|---|
OnCloseButtonClick | TToolbarClickEvent | — | Fires when a tab's close button is clicked; this is where you remove the tab and its content. |
OnPaintCloseButton | TPaintCloseButtonEvent | — | Fires while the close button is drawn, so you can style it yourself. |
OnItemClick | TToolbarClickEvent | — | Fires when an item is clicked. |
OnItemDown | TToolbarClickEvent | — | Fires when a tab is pressed. |
OnItemFocusChanged | TNotifyEvent | — | Fires when the focused tab changes. |
OnDrawItem | TMlToolbarItemDrawEnvent | — | Fires while an item is drawn, so you can style it yourself. |
OnButtonWidthChanged | TToolbarButtonWidthEvent | — | Fires after a tab's width changes. |
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.