TMlSkinForm

The core skinning component. Drop it on a form and it takes over the background, border and title bar drawing. This is where MLSkin starts.

Category
Forms & borders
Unit
uMlSkinForm.pas
Inherits from
TMlHookWindowProc

Notes

  • One per form. As soon as it is placed, the form switches to the MLSkin look.
  • Style picks the background: ssColor uses Color, ssPicture uses the image in CustomPicture, laid out according to FillStyle.
  • It draws the title bar: TitleHeight for the height, TitlerColor for the color. Title-bar controls such as TMlSkinNCButton and TMlSkinNCLabel rely on it.
  • Two kinds of rounded corners: RoundCorner draws them, NativeRoundCorner hands them to the Windows 11 system corners.
  • ShadowEnabled turns on the self-drawn form shadow (new in v5.7), tuned with ShadowColor, ShadowSize and ShadowAlpha.
  • For custom-shaped forms, set a border image through ImageBorder.

Example

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

object mlsknfrm1: TMlSkinForm
  FlatFrame = True
  TitleHeight = 56
  TitlerColor = 15434544
  Color = clWhite
  RoundWindow = False
  FramWidth = 0
  ActiveGradient = False
  MainMenu.Font.Charset = DEFAULT_CHARSET
  MainMenu.Font.Color = clWindowText
  MainMenu.Font.Height = -11
  MainMenu.Font.Name = 'Tahoma'
  MainMenu.Font.Style = []
  MainMenu.Pos.Align = caLeft
  MainMenu.Pos.XValue = 5
  MainMenu.Pos.YValue = 5
  MainMenu.Pos.UseDefault = False
  MainMenu.Pictures.Active = True
  MainMenu.Pictures.Image = 'MlSkinFlatBtn'
  MainMenu.Pictures.Normal = 0

Properties 29

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.
FlatFrameBooleanFalseFlat border: draws the form border as a single flat line with no 3-D effect.
TitleHeightInteger27Height of the title bar in pixels. Title-bar buttons, labels and other controls are laid out within it.
TitlerColorTColor$00FFC446Title bar color, used when Style is ssColor. With a picture background the title bar comes from the image.
ColorTColor$00F2ECE1Form background color, used as the base color of the whole form when Style is ssColor.
OptionsTMlSkinFormOptionsForm behaviour options: minimize to the taskbar, hide from the taskbar, and whether the full window content is drawn while dragging.
RoundWindowBooleanTrueTurns the form corners round; the radius comes from RoundCorner.
RoundCornerInteger2Corner radius in pixels. Larger values give rounder corners; 0 means square.
NativeRoundCornerBooleanTrueUse the system corners: on Windows 11 the rounded corners are drawn by the OS, with system anti-aliasing. It has no effect on older Windows, where RoundCorner should be used instead.
NativeBorderColorTColorclDefaultColor of the system-drawn window border, used together with NativeRoundCorner on Windows 11.
FramWidthInteger2Border width in pixels.
FrameColorTColorclBlackBorder color.
FillStyleTMlFillStylemfsBlurHow the background image fills the form: mfsStretch stretch, mfsTile tile, mfs9Block nine-slice (corners keep their shape), mfsBlur blurred fill.
HitTestWidthInteger5Width in pixels of the resize-sensitive strip along the form edge. Too small is hard to grab; too large interferes with controls near the edge.
EraseBackGroundBooleanFalseWhether the background is erased before painting. Worth toggling if the form flickers.
GradientHeightInteger168Height in pixels of the title-bar gradient, used together with ActiveGradient.
CustomPictureTMlResIDBackground image of the form: an image ID from the resource manager or a file path. Style must be ssPicture for it to show.
StyleTMlSkinStylessColorSkin mode: ssColor uses solid colors (Color, TitlerColor), ssPicture uses the image in CustomPicture. Switching skins usually means changing this property and the matching color or image.
ActiveGradientBooleanTrueTurns on the title-bar gradient, drawn over the height given by GradientHeight.
SkinResTMlSkinResThe image resource component (TMlSkinRes) to bind to. Once set, the form and its controls resolve image IDs from that resource.
ImageBorderTmlFormLayerBorderImage border settings: the border picture, the size of each edge and how it is stretched — the basis for custom-shaped forms.
MainMenuTMlSkinMainMenuThe skinned main menu to attach. Once set, the menu is drawn by MLSkin and can be shown on the title bar.
DoubleFrameBooleanTrueDouble border: draws a second line inside the border, often used as a light inner stroke.
KeepTitlerColorBooleanFalseKeeps the title-bar color unchanged when the skin changes, even if the background image or skin color does.
KeepFrameColorBooleanFalseKeeps the border color unchanged when the skin changes.
ShadowEnabledBooleanFalseTurns on the self-drawn form shadow (new in v5.7): MLSkin paints the shadow around the form instead of relying on the system one.
ShadowColorTColorclBlackShadow color.
ShadowSizeInteger20Shadow size in pixels, i.e. how far the shadow spreads outwards.
ShadowAlphaByte90Shadow opacity: 0 is fully transparent, 255 fully opaque.

Events 1

NameTypeDefaultDescription
ChangedTNotifyEventFires after the skin settings change; useful for refreshing 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.