Notes
NumCount is the total number of pages; the previous and next buttons fire OnPreviousClick and OnNextClick.
OnNumChanged fires when the page changes — that is where you load the data for the new page.
Kinds decides which parts are shown: page numbers, prev/next buttons, a jump box and so on.
- Normal pages and the current page are styled separately through
ColorNormal, ColorFocus and FontFocus.
Example
From the demo MlSkin.Demo.翻页栏+透明背景ListBox.v.3.0 (.dfm form file)
object mlcb1: TMlSkinCountBar
Left = 1
Top = 428
Width = 591
Height = 34
Color = 16185078
FontFocus.Charset = DEFAULT_CHARSET
FontFocus.Color = clWhite
FontFocus.Height = -13
FontFocus.Name = 'Tahoma'
FontFocus.Style = []
ColorNormal = clWhite
OnSkipClick = mlcb1SkipClick
OnNumChanged = mlcb1NumChanged
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = []
Alpha = 196
Properties 20
| Name | Type | Default | Description |
|---|
AlignWithItems | TMlItemHAlign | ihaLeft | Horizontal alignment of the items inside the control: ihaLeft, ihaCenter or ihaRight. |
AlignVerticalWithItems | TMlItemVAlign | ihavTop | Vertical alignment of the items inside the control: top, centre or bottom. |
CaptionVisible | Boolean | True | Whether the caption is drawn. Turn it off for icon-only buttons. |
ItemWidth | Integer | — | Width of each item in pixels. |
ItemHeight | Integer | — | Height of each item in pixels. |
ItemSpaceSize | Integer | 10 | Gap between items in pixels. |
MarginBorderSize | Integer | 10 | Padding between the content and the control edge, in pixels. |
Kinds | TCountKinds | — | Which parts of the pager are shown — page numbers, previous/next buttons, a jump box — in any combination. |
NumCount | Cardinal | 5 | Total number of pages. |
FontFocus | TFont | — | Font of the current page number. |
ColorNormal | TColor | $00EEEEEE | Background colour of the normal page numbers. |
ColorFocus | TColor | $004966FE | Background colour of the current page number. |
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 8
| Name | Type | Default | Description |
|---|
OnDrawItem | TMlIconButtonItemDrawEnvent | — | Fires while an item is drawn, so you can style it yourself. |
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. |
OnNextClick | TNotifyEvent | — | Fires when the next-page button is clicked. |
OnPreviousClick | TNotifyEvent | — | Fires when the previous-page button is clicked. |
OnSkipClick | TNotifyEvent | — | Fires when the user jumps to a page with the jump box. |
OnNumChanged | TNotifyEvent | — | Fires after the current page changes — load that page's data here. |
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.