类型参考

MLSkin 类型参考

控件属性和事件里用到的 52 个类型:枚举的每个取值、子属性类的成员、事件参数的含义。

大部分类型声明在 uMlSkinIntf.pas,少数随控件声明在控件自己的单元里(标题旁注明了单元)。代码里用到时,在 uses 里引用对应的单元。属性表「类型」一栏里带链接的类型,都能在本页查到。

基础类型

TMlResIDuMlSkinIntf.pas

TMlResID = type string;

图片资源 ID,本质是字符串。填 TMlSkinRes / 资源管理器里登记的图片名称(例如 MlSkinDropdownMenu),控件绘制时按名称到资源里取图。声明成单独的类型是为了让对象检查器给它配上下拉选择框:点开就能从已加载的资源里挑图,不用手敲名称。

用到它的属性 59

BackgroundTMlSkinAlphaFormBackgroundImageTMlSkinBorderPanel TMlSkinCalloutPanel TMlSkinCircleShape TMlSkinColorComboBox TMlSkinComboBox TMlSkinCountBar 等 15 个控件Bar_BackgroundTMlSkinProgressBarBar_ProgressTMlSkinProgressBarBorderEffectHotTMlSkinBorderPanel TMlSkinColorComboBox TMlSkinComboBox TMlSkinListBox TMlSkinMemoExBorderEffectNormalTMlSkinBorderPanel TMlSkinColorComboBox TMlSkinComboBox TMlSkinListBox TMlSkinMemoExBorderHotTMlSkinComboBoxEx TMlSkinDatetimePicker TMlSkinEdit TMlSkinNCEdit TMlSkinPasswordEdit TMlSkinSearchEdit 等 7 个控件BorderNormalTMlSkinComboBoxEx TMlSkinDatetimePicker TMlSkinEdit TMlSkinNCEdit TMlSkinPasswordEdit TMlSkinSearchEdit 等 7 个控件CloseImageTMlSkinSystemButtonCollapseIconTMlSkinExpandBoxCustomPictureTMlSkinFormDropArrowHotTMlSkinComboBoxDropArrowNormalTMlSkinComboBoxDropdownMenuImageTMlSkinColorButtonExpandIconTMlSkinExpandBoxHotImageTMlSkinColorButtonIcon_FailueTMlSkinPopupMessageIcon_InformationTMlSkinPopupMessageIcon_SuccessTMlSkinPopupMessageImageTMlFormLayerBorder TMlSkinColorButton TMlSkinSizeGrip TMlSkinToolButtonItemHotImageTMlSkinIconButtonListLogoTMlSkinTitleBarMaximizeImageTMlSkinSystemButtonMenu_CheckTMlSkinMenuMenu_RadioTMlSkinMenuMenu_SubArrowTMlSkinMenuMenu_bkTMlSkinMenuMenu_hilightTMlSkinMenuMinimizeImageTMlSkinSystemButtonMlResIDTMlSkinSvgAnimate TMlSkinSvgImagePasswordCharTMlSkinPasswordEditPictureTMlSkinCircleShape TMlSkinNCImagePicturesTMlSkinCheckBox TMlSkinGroupControls TMlSkinRadioBoxRestoresizeImageTMlSkinSystemButtonScrollbar_arrowdown_downTMlSkinScrollBarScrollbar_arrowdown_highlightTMlSkinScrollBarScrollbar_arrowdown_normalTMlSkinScrollBarScrollbar_arrowleft_downTMlSkinScrollBarScrollbar_arrowleft_highlightTMlSkinScrollBarScrollbar_arrowleft_normalTMlSkinScrollBarScrollbar_arrowright_downTMlSkinScrollBarScrollbar_arrowright_highlightTMlSkinScrollBarScrollbar_arrowright_normalTMlSkinScrollBarScrollbar_arrowup_downTMlSkinScrollBarScrollbar_arrowup_highlightTMlSkinScrollBarScrollbar_arrowup_normalTMlSkinScrollBarScrollbar_bar_downTMlSkinScrollBarScrollbar_bar_highlightTMlSkinScrollBarScrollbar_bar_normalTMlSkinScrollBarScrollbar_bkgTMlSkinScrollBarScrollbar_horz_bkgTMlSkinScrollBarScrollbar_horzbar_downTMlSkinScrollBarScrollbar_horzbar_highlightTMlSkinScrollBarScrollbar_horzbar_normalTMlSkinScrollBarTabDownPictureTMlSkinPageControlTabHotPictureTMlSkinPageControlTabNormalPictureTMlSkinPageControlThumbTMlHLSTrackBarTitleIconTMlSkinExpandBox

TMlSkinImageuMlSkinIntf.pas

TMlSkinImage = class(TBitmap32)
  public
    constructor Create; override;
    procedure CopyPropertiesTo(Dst: TCustomBitmap32); override;
    property Tag: Integer read FTag write SetTag;
    property IsFromSVG: Boolean read FIsFromSVG write SetIsFromSVG;
end;

MlSkin 内部统一使用的图片对象,继承自 Graphics32 的 TBitmap32(32 位带透明通道)。资源管理器返回的、各控件缓存的都是它;在 OnCustomPaint 等自绘事件里拿到的位图也可以按 TBitmap32 的方式直接画。

取值 / 成员说明
Tag附加的整数标记,库里不使用,留给调用方存自定义数据。
IsFromSVG这张图是否由 SVG 渲染而来。资源管理器据此决定 DPI 变化时是重新按新尺寸渲染 SVG,还是缩放位图。

TmlColoruMlSkinIntf.pas

TmlColor = type cardinal;

32 位 ARGB 颜色值(无符号整数),用于直接读写位图像素。和 VCL 的 TColor($00BBGGRR,不带透明度)不是一回事,两者之间要用 Color32 等函数转换。

枚举与集合

TEllipsisPositionuMlSkinIntf.pas

TEllipsisPosition = (epNone, epPathEllipsis, epEndEllipsis, epWordEllipsis);

文字放不下时省略号放在哪里。底层对应 Windows DrawText 的省略标志(单元里的常量数组 MlEllipsis 做了映射)。

取值 / 成员说明
epNone不省略,超出部分直接裁掉。
epPathEllipsis在中间省略,保留开头和结尾,适合显示文件路径(DT_PATH_ELLIPSIS)。
epEndEllipsis在末尾省略(DT_END_ELLIPSIS)。
epWordEllipsis按整词截断后加省略号(DT_WORD_ELLIPSIS)。

用到它的属性EllipsisPositionTMlSkinLabel TMlSkinNCLabel TMlURLButton

TGradientAlignuMlSkinIntf.pas

TGradientAlign = (gaCenter, gaLeft, gaRight);

渐变从哪里开始。和 GradientSize(渐变区域占控件长度的百分比)配合使用。uMlSkinLine.pas 里也声明了一个同名、同取值的类型,供 TMlSkinLine 使用。

取值 / 成员说明
gaCenter从中间向两边对称渐变。
gaLeft从左端(垂直方向时为顶端)开始。
gaRight从右端(垂直方向时为底端)开始。

用到它的属性GradientAlignTMlSkinBorderPanel TMlSkinColorComboBox TMlSkinComboBox TMlSkinGroupControls TMlSkinLine TMlSkinListBox 等 9 个控件

TMlTextKinduMlSkinIntf.pas

TMlTextKind = (tkAll, tkEN, tkNumInt, tkNumReal, tkENandNum);

输入框允许输入的内容。在按键阶段就过滤掉不合规的字符。

取值 / 成员说明
tkAll不限制。
tkEN只允许英文字母。
tkNumInt只允许整数。
tkNumReal数字,允许小数点和负号。
tkENandNum英文字母加数字。

用到它的属性TextKindTMlSkinDatetimePicker TMlSkinEdit TMlSkinNCEdit

TMlSwitchButtonCaptionAlignuMlSkinIntf.pas

TMlSwitchButtonCaptionAlign = (sbcaLeft, sbcaRigth);

开关按钮的文字放在开关的哪一边。注意右侧的取值在源码里拼作 sbcaRigth(为兼容已有 dfm 没有改名)。

取值 / 成员说明
sbcaLeft文字在开关左边。
sbcaRigth文字在开关右边。

用到它的属性CaptionAlignTMlSkinSwitchButton

TMlCorneruMlSkinIntf.pas

TMlCorner = (TopLeft, TopRight, BottomLeft, BottomRight);

矩形的一个角,用作 TMlCorners 集合的元素。

取值 / 成员说明
TopLeft左上角。
TopRight右上角。
BottomLeft左下角。
BottomRight右下角。

TMlCornersuMlSkinIntf.pas

TMlCorners = set of TMlCorner;

要画成圆角的那些角,可任意组合。例如按钮组里最左边的按钮只圆左边两个角:Corners := [TopLeft, BottomLeft]。

TSideuMlSkinIntf.pas

TSide = (sdLeft, sdTop, sdRight, sdBottom);

矩形的一条边,用作 TSides 集合的元素。

取值 / 成员说明
sdLeft左边。
sdTop上边。
sdRight右边。
sdBottom下边。

TMlSkinStyleuMlSkinIntf.pas

TMlSkinStyle = (ssColor, ssPicture);

窗体皮肤的着色方式。换肤的核心开关:改成另一种方式后,再设对应的颜色或图片即可。

取值 / 成员说明
ssColor纯色皮肤,使用 Color / TitlerColor 等颜色属性。
ssPicture图片皮肤,使用 CustomPicture 指定的背景图,铺法由 FillStyle 决定。

用到它的属性StyleTMlSkinForm

TMlFillStyleuMlSkinIntf.pas

TMlFillStyle = (mfsBlur, mfsTile, mfsStretch, mfs9Block);

图片皮肤(ssPicture)时背景图怎样铺满窗体。

取值 / 成员说明
mfsBlur原图贴在左上角,图片的右边和下边做渐隐过渡,窗体其余部分用图片的平均色填充,图片比窗体小也不会露出硬边。默认值。
mfsTile平铺。
mfsStretch拉伸铺满整个窗体。
mfs9Block九宫格拉伸:四个角保持原样,四边和中间拉伸,适合带圆角或花边的背景图。

用到它的属性FillStyleTMlSkinForm

TMlPngFillTypeuMlSkinIntf.pas

TMlPngFillType = (ftNormal, ftTile, ftAutoStretch, ftCenter, ftStretch, ftGradient);

背景图片在控件里的铺法(面板等控件的 BackgroundFillType)。

取值 / 成员说明
ftNormal原尺寸画在左上角。
ftTile平铺。
ftAutoStretch拉伸到控件大小(宽高各自拉伸)。
ftCenter原尺寸居中。
ftStretch拉伸铺满。
ftGradient不用图片,改画渐变色(方向、颜色、对齐由 Gradient* 属性决定)。

用到它的属性BackgroundFillTypeTMlSkinBorderPanel TMlSkinCalloutPanel TMlSkinColorComboBox TMlSkinComboBox TMlSkinGroupControls TMlSkinListBox 等 12 个控件

TMlSkinCustomComboBoxStyleuMlSkinIntf.pas

TMlSkinCustomComboBoxStyle = (csDropDown, csDropDownList);

下拉框能不能手动输入。

取值 / 成员说明
csDropDown可编辑:既能从列表里选,也能直接输入文字。默认值。
csDropDownList只能从列表里选,不能输入。

用到它的属性StyleTMlSkinComboBox TMlSkinComboBoxEx

TMlColorBoxStylesRecuMlSkinIntf.pas

TMlColorBoxStylesRec = (mlcbStandardColors, mlcbExtendedColors,
  mlcbSystemColors, mlcbIncludeNone, mlcbIncludeDefault, mlcbCustomColor, mlcbPrettyNames);

颜色下拉框列表里包含哪些颜色项,作为 TMlColorBoxStyles 集合的元素。取值含义与 VCL TColorBox.Style 一致。

取值 / 成员说明
mlcbStandardColors16 种标准颜色(clBlack、clRed …)。
mlcbExtendedColors扩展颜色(clMoneyGreen、clSkyBlue、clCream、clMedGray)。
mlcbSystemColors系统颜色(clBtnFace、clWindow 等跟随系统主题的颜色)。
mlcbIncludeNone包含 clNone(无颜色)。
mlcbIncludeDefault包含 clDefault(默认颜色)。
mlcbCustomColor增加一个「自定义…」项,选中后弹出颜色对话框任选颜色。
mlcbPrettyNames显示友好的颜色名(去掉 cl 前缀,例如显示 Red 而不是 clRed)。

TMlColorBoxStylesuMlSkinIntf.pas

TMlColorBoxStyles = set of TMlColorBoxStylesRec;

颜色下拉框的列表内容,可组合多项,例如 ExStyle := [mlcbStandardColors, mlcbCustomColor, mlcbPrettyNames]。

用到它的属性ExStyleTMlSkinColorComboBox

TNCBoderSideKinduMlSkinIntf.pas

TNCBoderSideKind = (skTitle, skLeft, skRight, skBottom);

窗体非客户区边框的哪一段,TMlSkinForm 绘制标题栏和窗口边框时内部使用,一般不需要在代码里用到。

取值 / 成员说明
skTitle标题栏。
skLeft左边框。
skRight右边框。
skBottom底边框。

TMlEditTipsPositionuMlSkinEditTips.pas

TMlEditTipsPosition = (etpRight, etpLeft, etpTop, etpBottom);

输入框红色校验提示(Tips.Show)弹出在输入框的哪一边。通过 Tips.Position 设置,和提示框与输入框之间的距离 Tips.Spacing(默认 5,按 96 DPI 像素,运行时自动按 DPI 缩放)一起使用。

取值 / 成员说明
etpRight右侧,与输入框垂直居中。默认值。
etpLeft左侧。
etpTop上方,与输入框左边对齐。
etpBottom下方,与输入框左边对齐。

用到它的属性TMlSkinEdit.Tips.Position、TMlSkinNCEdit.Tips.Position

TGroupBoxFrameStyleuMlSkinBoxCtrls.pas

TGroupBoxFrameStyle = (fsLine, fsBox, fsCard);

分组框的外框样式。

取值 / 成员说明
fsLine只在标题后画一条分隔线(颜色从 LineStartColor 渐变到 LineStopColor)。默认值。
fsBox画完整的方框。
fsCard卡片样式:标题在上方靠左,下面是抗锯齿圆角卡片,边框色取 LineStartColor,底色取 CardColor(clNone 只画边框)。

用到它的属性FrameStyleTMlSkinGroupBox

TMlTitleBarButtonKinduMlSkinTitleBar.pas

TMlTitleBarButtonKind = (tbkMinimize, tbkMaximize, tbkRestore, tbkClose, tbkCustom);

TMlSkinTitleBar 上按钮的种类,在 OnDrawButton 里用来区分正在画哪个按钮。

取值 / 成员说明
tbkMinimize最小化按钮。
tbkMaximize最大化按钮(窗体未最大化时)。
tbkRestore还原按钮(窗体已最大化时,最大化按钮变成它)。
tbkClose关闭按钮。
tbkCustomButtons 集合里的自定义按钮,具体是哪个看事件的 Index 参数。

TMlTitleBarButtonStateuMlSkinTitleBar.pas

TMlTitleBarButtonState = (tbsNormal, tbsHot, tbsDown);

TMlSkinTitleBar 按钮的当前状态。

取值 / 成员说明
tbsNormal普通。
tbsHot鼠标悬停。
tbsDown按下(鼠标按住且仍停在按钮上)。

TNCButtonStateuMlSkinNCButton.pas

TNCButtonState = (bsNormal, bsHot, bsPressed);

标题栏按钮(TMlSkinNCButton、TMlSkinSystemButton)的当前状态,OnDrawButton 事件里传入。

取值 / 成员说明
bsNormal普通。
bsHot鼠标悬停。
bsPressed按下。

TSystemButtonKinduMlSkinNCButton.pas

TSystemButtonKind = (bkClose, bkMinimize, bkMaximize);

TMlSkinSystemButton 扮演哪个系统按钮,点击时执行对应的窗口操作。

取值 / 成员说明
bkClose关闭。默认值。
bkMinimize最小化。
bkMaximize最大化 / 还原。

用到它的属性KindTMlSkinSystemButton

子属性类(对象检查器里可展开的属性)

TPngPicturesuMlSkinIntf.pas

TPngPictures = class(TPersistent)
  public
    procedure Assign(Source: TPersistent); override;
    constructor Create;
    destructor Destroy; override;
    function GetNormalImage(var AImage: TMlSkinImage): Boolean;
    function GetHotImage(var AImage: TMlSkinImage): Boolean;
    function GetPressedImage(var AImage: TMlSkinImage): Boolean;
    function GetDisableImage(var AImage: TMlSkinImage): Boolean;
    function GetSingleWidth: Integer;
    function GetSingleHeight: Integer;
    property SourceImage: TMlSkinImage read FSourceImage;
    procedure Lock;
    procedure UnLock;
  published
    property Active: Boolean read FActive write SetActive;
    property MultiLineMode: Boolean read FMultiLineMode write SetMultiLineMode default False;
    property Image: TMlResID read FImage write SetImage;
    property Normal: Integer read FNormal write SetNormal;
    property Hot: Integer read FHot write SetHot;
    property Disable: Integer read FDisable write SetDisable;
    property Count: Integer read FCount write SetCount;
    property Pressed: Integer read FPressed write SetPressed;
    property SourceSize: TSize read GetSourceSize;
    property PicturesChanged: TNotifyEvent read FPicturesChanged write SetPicturesChanged;
end;

「一张图里横排着几种状态」的按钮图片设置。Image 指定一张长条图,按 Count 等分成若干帧,再用 Normal / Hot / Pressed / Disable 指定各状态用第几帧(从 0 开始)。高 DPI 下会自动换用对应倍率的资源图。运行时改 Pressed 或 MultiLineMode 不会自动重绘,改完调用一次控件的 Invalidate。

取值 / 成员说明
Active是否使用这组图片。关闭后控件不画图片(例如只显示文字,或改用 Flat 矢量样式)。
MultiLineMode帧的排列方向:False 横向排列(默认),True 纵向叠放。
Image长条图的资源 ID(TMlResID)。
Count图里一共有几帧,默认 3。
Normal普通状态用的帧序号,默认 0。
Hot鼠标悬停时用的帧序号,默认 1。
Pressed按下时用的帧序号,默认 2。
Disable禁用时用的帧序号,默认 0(和普通状态共用一帧)。
SourceSize只读,整张源图的宽高。
PicturesChanged图片设置变化时的通知,由所属控件挂接用来重绘,一般不要自己改。
GetNormalImage / GetHotImage / GetPressedImage / GetDisableImage把对应状态的那一帧取到传入的 TMlSkinImage 里,成功返回 True。自绘时使用。
GetSingleWidth / GetSingleHeight单帧的宽、高(像素)。
Lock / UnLock批量修改多个属性时先 Lock,期间不触发重绘通知,改完 UnLock。
用到它的属性 10

ButtonImageTMlSkinTabset TMlSkinToolbarButtonLeftTMlSkinImageSliderButtonPicturesTMlSkinMessageBoxStyleButtonRightTMlSkinImageSliderCloseButtonTMlSkinTabsetImageOFFTMlSkinSwitchButtonImageONTMlSkinSwitchButtonLayersTMlSkinButton TMlSkinImageButton TMlSkinToolButtonPictureTMlSkinNCButton TMlSkinSystemButtonPicturesTMlSkinButton TMlSkinImageButton TMlSkinToolButton

TPngPicturesExuMlSkinIntf.pas

TPngPicturesEx = class(TPngPictures)
end;

TPngPictures 的派生类,没有新增任何成员,用法完全相同。

TMlLightClassuMlSkinIntf.pas

TMlLightClass = class(TPersistent)
  public
    constructor Create;
    procedure Assign(Source: TPersistent); override;
  published
    property BlurRadius: Integer read FBlurRadius write SetBlurRadius default 1;
    property Active: Boolean read FActive write SetActive default False;
    property Color: TColor read FColor write SetColor default $FFFFFE;
    property OnChanged: TNotifyEvent read FOnChanged write SetOnChanged;
end;

文字发光(外发光描边)效果,常见于深色或图片背景上让文字更清楚。各控件的 Light、CaptionLight、MessageLight 属性都是这个类型。

取值 / 成员说明
Active是否启用发光,默认关闭。
Color发光颜色,默认接近白色($FFFFFE)。
BlurRadius发光的模糊半径(像素),越大光晕越宽,默认 1。
OnChanged设置变化时的通知,由所属控件挂接用来重绘。

用到它的属性CaptionLightTMlSkinGroupBox TMlSkinMessageBoxStyle TMlSkinPageControlLightTMlSkinCheckBox TMlSkinLabel TMlSkinNCLabel TMlSkinRadioBox TMlSkinToolButton TMlURLButtonMessageLightTMlSkinMessageBoxStyle

TMlTextObjuMlSkinIntf.pas

TMlTextObj = class(TPersistent)
  public
    constructor Create;
    destructor Destroy; override;
    procedure Assign(Source: TPersistent); override;
  published
    property Light: TMlLightClass read FLight write SetLight;
    property Text: string read FText write SetText;
    property Visible: Boolean read FVisible write SetVisible default True;
    property OnChanged: TNotifyEvent read FOnChanged write SetOnChanged;
end;

带显示开关和发光效果的一段文字。工具栏的 Text 属性就是它。

取值 / 成员说明
Text文字内容。
Visible是否显示,默认显示。
Light文字发光效果(TMlLightClass)。
OnChanged设置变化时的通知,由所属控件挂接用来重绘。

TMlCaptionuMlSkinIntf.pas

TMlCaption = class(TMlTextObj)
  public
    constructor Create;
    destructor Destroy; override;
    procedure Assign(Source: TPersistent); override;
  published
    property OffsetX: Integer read FOffsetX write SetOffsetX default 0;
    property OffsetY: Integer read FOffsetY write SetOffsetY default 0;
    property Font: TFont read FFont write SetFont;
end;

在 TMlTextObj 的基础上加了字体和位置偏移的标题文字,用于进度条、环形进度等控件中间显示的文字(例如百分比)。

取值 / 成员说明
Font文字字体。
OffsetX相对默认位置的水平偏移(像素),正数右移。
OffsetY相对默认位置的垂直偏移(像素),正数下移。

用到它的属性CaptionTMlSkinCircleProgress TMlSkinProgressBar

TMlOffsetuMlSkinIntf.pas

TMlOffset = class(TPersistent)
  public
    constructor Create;
    destructor Destroy; override;
  published
    property X: Integer read FX write SetX;
    property Y: Integer read FY write SetY;
    property OnChanged: TNotifyEvent read FOnChanged write SetOnChanged;
end;

一对 X / Y 偏移量(像素),用来微调文字、关闭按钮等元素在控件里的位置。

取值 / 成员说明
X水平偏移,正数右移。
Y垂直偏移,正数下移。
OnChanged数值变化时的通知,由所属控件挂接用来重绘。

用到它的属性CaptionOffsetTMlSkinNCButtonCloseButtonOffsetTMlSkinTabsetOffsetTMlSkinGroupControls

TMlTitleBarButtonuMlSkinTitleBar.pas

TMlTitleBarButton = class(TCollectionItem)
  public
    constructor Create(Collection: TCollection); override;
    procedure Assign(Source: TPersistent); override;
  published
    property Image: TMlResID read FImage write SetImage;
    property Hint: string read FHint write FHint;
    property Visible: Boolean read FVisible write SetVisible default True;
    property Tag: Integer read FTag write FTag default 0;
    property OnClick: TNotifyEvent read FOnClick write FOnClick;
end;

TMlSkinTitleBar.Buttons 集合里的一个自定义按钮,排在最小化按钮左边。

取值 / 成员说明
Image按钮图标的资源 ID。
Hint鼠标停留时显示的提示文字(需要标题栏 ShowHint 打开)。
Visible是否显示,隐藏后不占位置。
Tag自定义整数,方便在共用的点击事件里区分按钮。
OnClick点击按钮时触发。

TMlTitleBarButtonsuMlSkinTitleBar.pas

TMlTitleBarButtons = class(TOwnedCollection)
  public
    function Add: TMlTitleBarButton;
    property Items[Index: Integer]: TMlTitleBarButton read GetItem; default;
end;

TMlSkinTitleBar 的自定义按钮集合。设计期在对象检查器里点 Buttons 添加;运行时用 Add 新增,用 Items[i](默认属性,可直接写 Buttons[i])访问。

用到它的属性ButtonsTMlSkinTitleBar

事件类型

TMlDrawSkinItemEventuMlSkinIntf.pas

TMlDrawSkinItemEvent = procedure(Sender: TObject; Cnvs: TCanvas; Index:
  Integer; ItemWidth, ItemHeight: Integer; TxtRect: TRect; State: TOwnerDrawState) of object;

列表项自绘事件。Cnvs 是画布,Index 是项序号,ItemWidth / ItemHeight 是项的宽高,TxtRect 是文字区域,State 是选中 / 焦点等状态(odSelected、odFocused …)。

用到它的属性OnComboBoxDrawItemTMlSkinComboBoxOnDrawItemTMlSkinListBoxOnListBoxDrawItemTMlSkinComboBox

TMlNCButtonDrawEventuMlSkinNCButton.pas

TMlNCButtonDrawEvent = procedure(Sender: TObject; Canvas: TBitmap32; const R: TRect;

标题栏按钮的自绘事件。Canvas 是整个标题栏的绘制缓冲,R 是按钮所在区域,State 是按钮当前状态;把 Handled 设为 True 就跳过默认的图片和文字绘制,只保留你画的内容。

用到它的属性OnDrawButtonTMlSkinNCButton

TMlTitleBarDrawButtonEventuMlSkinTitleBar.pas

TMlTitleBarDrawButtonEvent = procedure(Sender: TObject; Bitmap: TBitmap32; Kind: TMlTitleBarButtonKind;

TMlSkinTitleBar 的按钮自绘事件,在画每个按钮前触发。Bitmap 是整个标题栏的缓冲位图,Kind 是按钮种类,Index 是自定义按钮在 Buttons 里的序号(系统按钮为 -1),R 是按钮区域,State 是状态。Handled := True 则不再画默认的背景和图形;只想换底色时,可以自己画背景后调用 DrawButtonGlyph 画默认的 —/□/X 线条。

用到它的属性OnDrawButtonTMlSkinTitleBar

底层类型(自绘与控件内部使用)

TDynMlSkinImageuMlSkinIntf.pas

TDynMlSkinImage = array of TMlSkinImage;

TMlSkinImage 的动态数组,用于缓存一组图片帧。释放时调用 FreeDynImg,它会逐个释放元素再清空数组。

TImgArray9BlockuMlSkinIntf.pas

TImgArray9Block = array[0..2, 0..2] of TMlSkinImage;

3×3 的 TMlSkinImage 数组,存放九宫格切图(四角、四边、中间)。释放用 FreeArray9BlockImg。

TPngArrayuMlSkinIntf.pas

TPngArray = array of TPngImage;

TPngImage 的动态数组,释放用 FreeDynPng。

TPngArray9BlockuMlSkinIntf.pas

TPngArray9Block = array[0..2, 0..2] of TPngImage;

3×3 的 TPngImage 九宫格切图,释放用 FreeArray9BlockPng。

TPngArray3BlockuMlSkinIntf.pas

TPngArray3Block = array[0..2] of TPngImage;

3 段的 TPngImage 切图(左、中、右或上、中、下),用于只在一个方向拉伸的图片。释放用 FreeArray3BlockPng。

TmlColorRecuMlSkinIntf.pas

TmlColorRec = packed record
    case cardinal of
      0:
        (Color: cardinal);
      2:
        (HiWord, LoWord: Word);
      3:
        (B, G, R, A: Byte);
end;

把一个 32 位颜色按字节拆开访问的变体记录:可以整体读写 Color,也可以分别读写 B、G、R、A 四个分量(内存顺序为 BGRA,与 Windows 32 位位图一致)。

TmlColorRecBoruMlSkinIntf.pas

TmlColorRecBor = packed record
    case cardinal of
      0:
        (Color: cardinal);
      2:
        (HiWord, LoWord: Word);
      3:
        (R, G, B, A: Byte);
end;

和 TmlColorRec 相同,但分量顺序是 RGBA,对应 Delphi TColor 的字节排列。

TmlColorArrayuMlSkinIntf.pas

TmlColorArray = array[0..0] of TmlColor;

TmlColor 的开放数组,配合指针 PmlColorArray 按下标访问一段像素内存(声明上界是 0,访问时需关闭范围检查)。

TRGBQuadArrayuMlSkinIntf.pas

TRGBQuadArray = array[0..$EFFFFFF] of TRGBQuad;

TRGBQuad 的超大数组类型,通过 pRGBQuadArray 指针访问 32 位位图的扫描线(例如 pRGBQuadArray(Bmp.ScanLine[y])[x])。

TIntArrayuMlSkinIntf.pas

TIntArray = array[0..0] of Integer;

整数的开放数组,配合 PIntArray 按下标访问一段整数内存。

TMonitorInfouMlSkinIntf.pas

TMonitorInfo = record
    cbSize: DWORD;
    rcMonitor: TRect;
    rcWork: TRect;
    dwFlags: DWORD;
end;

Windows GetMonitorInfo 用的显示器信息结构:rcMonitor 是整个屏幕区域,rcWork 是去掉任务栏后的工作区。为兼容老版本 Delphi 在这里自带了一份声明。

TMlCBButtonXuMlSkinIntf.pas

TMlCBButtonX = record
    R: TRect;
    MouseIn: Boolean;
    Down: Boolean;
end;

下拉框内部记录下拉按钮状态用:按钮区域 R、鼠标是否在上面 MouseIn、是否按下 Down。

TMlCBItemuMlSkinIntf.pas

TMlCBItem = record
    R: TRect;
    State: TOwnerDrawState;
end;

下拉框内部记录当前项的区域 R 和绘制状态 State。

控件列表按分类浏览全部 79 个控件