TMlSkinNCButton

A button placed on the form title bar. It can show text or images and can stay pressed.

Category
Title-bar controls
Unit
uMlSkinNCButton.pas
Inherits from
TMlSkinCustomNCButtonTMlSkinNCCtrlBase

Notes

  • Position comes from the base class: PutSide (which edge) and Pos (alignment and offset).
  • The four states live in Picture: one image split into normal, hot, pressed and disabled frames.
  • Buttons sharing a GroupIndex are mutually exclusive, which combined with Down gives tab-like toggles.

Example

From the demo MlSkin.Demo.360云盘.v3.0 (.dfm form file)

object ncbtn1: TMlSkinNCButton
  Pos.Align = caLeft
  Pos.XValue = 200
  Pos.YValue = 0
  Pos.UseDefault = False
  Picture.Active = True
  Picture.Image = '.\Res\p1.png'
  Picture.Normal = 0
  Picture.Hot = 1
  Picture.Disable = 0
  Picture.Count = 2
  Picture.Pressed = 1
  Cursor = crHandPoint
  Down = True
  GroupIndex = 1
  OnClick = ncbtn1Click
  CaptionOffset.X = 0
  CaptionOffset.Y = 0
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText

Properties 4

NameTypeDefaultDescription
CaptionstringText shown on the button. Leave it empty for an image-only button.
CaptionOffsetTMlOffsetOffset (X, Y) of the caption inside the button, for fine positioning.
FontTFontFont of the button caption.
HotFontTFontFont used while the mouse is over the button, typically a different color for the hover effect.
Properties of TMlSkinCustomNCButton 6
NameTypeDefaultDescription
AllowAllUpBooleanFalseWhether all buttons in the group may be up at once. With it off, one button in the group always stays down.
PictureTPngPicturesThe image used by the control, given as a resource ID or an image file path.
CursorTCursorcrDefaultMouse cursor shape over the control.
DownBooleanFalseWhether the button is in the pressed state; combined with GroupIndex it behaves like a toggle or a tab.
GroupIndexInteger0Group number: buttons sharing a number are mutually exclusive, so only one stays down. 0 means no grouping.
EnabledBooleanTrueWhether the control is usable; when off it greys out and stops responding.
Events of TMlSkinCustomNCButton 1
NameTypeDefaultDescription
OnClickTNotifyEventFires when the control is clicked.
Properties of TMlSkinNCCtrlBase 6
NameTypeDefaultDescription
AboutTMlAboutInfoA 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.
PutSideTSideKindskdTopWhich edge of the non-client area the control sits on: skdTop, skdBottom, skdLeft or skdRight.
TagInteger0A spare integer for your own bookkeeping; the component itself does not use it.
PosTNCCtrlPosPosition along that edge: an alignment plus X/Y offsets. With UseDefault on, the default layout is used.
HintstringTooltip text shown when the mouse rests on the control.
VisibleBooleanTrueWhether the control is visible.
Events of TMlSkinNCCtrlBase 5
NameTypeDefaultDescription
OnLMouseDownTNotifyEventFires when the left mouse button goes down on the control.
OnLMouseUpTNotifyEventFires when the left mouse button is released on the control.
OnMouseEnterTNotifyEventFires when the mouse enters the control.
OnMouseLeaveTNotifyEventFires when the mouse leaves the control.
OnDPIChangedTMlDPIChangedEventFires 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.

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.