These are the routines you are likely to need; the library also contains internal drawing and helper functions that are not listed. Add the unit shown to your uses clause before calling one.
Message box
MlMessageBoxuMlSkinMessageBox.pas
function MlMessageBox(const ACaption, AMsg: string; AIcon: TMlMsgBoxIcon = biNone; Buttons: TMlMsgBoxButtons = []): Integer;
function MlMessageBox(const ACaption, AMsg: string; AIcon: TMlMsgBoxIcon; Buttons: TMlMsgBoxButtons; const AShowAgainFlag: Boolean; var AShowAgainFlagValue: Boolean): Integer;
function MlMessageBox(const ACaption, AMsg: string; AIcon: TMlMsgBoxIcon; Buttons: TMlMsgBoxButtons; const AShowAgainFlag: Boolean; var AShowAgainFlagValue: Boolean; const PosX, PosY: Integer): Integer;
Shows an MLSkin-styled message box in place of Delphi's own MessageBox. AIcon picks the icon (biNone, biWarning, biError, biInformation, biConfirmation) and Buttons is the set of buttons (mbOK, mbYes, mbNo, mbCancel, mbAbort, mbRetry, mbIgnore); the result tells you which one was clicked. The overload with AShowAgainFlag adds a "do not show again" check box and returns its state in AShowAgainFlagValue; the last overload also positions the dialog with PosX and PosY. The look comes from the TMlSkinMessageBoxStyle component on the form.
High-DPI
AppInHighDPIModeuMlComm.pas
function AppInHighDPIMode: Boolean;
Tells whether the application is currently running on a scaled display, i.e. above 100%.
AppIsHighDPIModeuMlComm.pas
function AppIsHighDPIMode: Boolean;
Tells whether the application is built and manifested for High-DPI support.
GetDPIScaleValueuMlComm.pas
function GetDPIScaleValue(Sender: TControl = nil): Double;
Returns the current DPI scale factor: 1.0 at 100%, 1.5 at 150%. Pass a control to use the monitor that control is on.
GetDPIScaledFontSizeuMlComm.pas
function GetDPIScaledFontSize(Sender: TControl; const Size: Integer): Integer;
Scales a font size to the current DPI.
GetDPIScaledImageListuMlComm.pas
function GetDPIScaledImageList(Sender: TControl; const Source: TCustomImageList; ItemIndex: Integer; out Dest: TBitmap32): Boolean;
function GetDPIScaledImageList(Sender: TControl; const Source: TCustomImageList; ItemIndex: Integer; out Dest: TPngImage): Boolean;
Pulls an image out of an ImageList already scaled for the current DPI, as a TBitmap32 or a TPngImage. Returns True when an image was produced.
GetDPIScaledPixelsuMlComm.pas
function GetDPIScaledPixels(Sender: TControl; const pPixels: Integer): Integer;
function GetDPIScaledPixels(Sender: TControl; const pPixels: TRect): TRect;
function GetDPIScaledPixels(Sender: TControl; const pPixels: TPoint): TPoint;
Converts a design-time pixel value to actual pixels at the current DPI. Three overloads take a plain number, a TPoint or a TRect — use them when sizing and positioning things you draw yourself.
SetDPIScaledFontuMlComm.pas
procedure SetDPIScaledFont(ScaledFont, DestFont: TFont);
procedure SetDPIScaledFont(Sender: TControl; DestFont: TFont);
Scales a font to the current DPI and writes it into the target font. The two overloads take either a control or a source font as the reference.
SVG
ColorToAlphaColoruMlSkinSvgLib.pas
function ColorToAlphaColor(AColor: TColor; Alpha: Byte = $FF): Cardinal;
Combines a TColor with an alpha value into the colour format used for SVG drawing.
DrawSvguMlSkinSvgLib.pas
procedure DrawSvg(const ACanvas: TCanvas; const DestRect: TRect; const SvgBrush: TMlSvgBrush; const AOpacity: Single = 1);
procedure DrawSvg(const ACanvas: TCanvas; const DestRect: TRect; const SvgSource: string; const AOpacity: Single = 1);
procedure DrawSvg(const Dest: TBitmap32; const DestRect: TRect; const SvgBrush: TMlSvgBrush; const AOpacity: Single = 1);
Draws an SVG onto a canvas or bitmap. The three overloads take an SVG brush object, an SVG source string, or a TBitmap32 target; AOpacity sets the opacity from 0 to 1.
SvgBrushToMlSkinImageuMlSkinSvgLib.pas
procedure SvgBrushToMlSkinImage(SvgBrush: TMlSvgBrush; var MlSkinImage: TMlSkinImage; const AScale: Single = 1; const AOpacity: Single = 1);
Renders an SVG brush object into an MLSkin image object.
SvgDataToMlSkinImageuMlSkinSvgLib.pas
procedure SvgDataToMlSkinImage(const SvgData: string; var MlSkinImage: TMlSkinImage; const AScale: Single = 1; const AOpacity: Single = 1);
Renders SVG source into an MLSkin image object, with AScale for the zoom factor and AOpacity for the opacity.
SvgFileToMlSkinImageuMlSkinSvgLib.pas
procedure SvgFileToMlSkinImage(const SvgFileName: string; var MlSkinImage: TMlSkinImage; const AScale: Single = 1);
Loads an SVG file and renders it into an MLSkin image object.
Images
ConvertBmpToPnguMlComm.pas
function ConvertBmpToPng(Bmp: TBitmap): TPngImage;
Converts a bitmap into a PNG image object and returns it.
ConvertToPNGuMlSkinPngLib.pas
procedure ConvertToPNG(Source: TGraphic; Dest: TPngImage);
Converts any graphic (bitmap, icon and so on) into a PNG.
CopyImageFromImageListuMlSkinPngLib.pas
procedure CopyImageFromImageList(Dest: TPngImage; ImageList: TCustomImageList; Index: Integer);
Copies one image out of an ImageList, by index, into a target PNG object.
DrawPNGuMlSkinPngLib.pas
procedure DrawPNG(Png: TPngImage; Canvas: TCanvas; const ARect: TRect; const Options: TPngOptions);
Draws a PNG into a rectangle on a canvas; Options controls how.
GetPngFromImageListuMlComm.pas
function GetPngFromImageList(ImageList: TImageList; const Index: Integer): TPngImage;
Returns the image at the given index of an ImageList as a PNG object.
MakeImageBlendeduMlSkinPngLib.pas
procedure MakeImageBlended(Image: TPngImage; Amount: Byte = 127);
Fades an image by blending it with transparency; Amount sets the strength.
MakeImageGrayscaleuMlSkinPngLib.pas
procedure MakeImageGrayscale(Image: TPngImage; Amount: Byte = 255);
Turns an image to greyscale, with Amount controlling the strength — the usual way to make a disabled icon.
SetBitmapAlphauMlComm.pas
procedure SetBitmapAlpha(Bmp: TBitmap; Alpha: Byte);
Applies one alpha value to the whole bitmap.
SlicePNGuMlSkinPngLib.pas
procedure SlicePNG(JoinedPNG: TPngImage; Columns, Rows: Integer; out SlicedPNGs: TObjectList);
Slices one combined image into a grid of PNGs, returned in an object list — handy when preparing multi-state artwork.
Resizing & slicing
CropBitmap32uMlComm.pas
procedure CropBitmap32(Src, Dst: TBitmap32; SrcX, SrcY: Integer);
Crops a region out of a bitmap by copying the pixels directly, with no blending, so semi-transparent pixels do not darken.
CropPNGuMlComm.pas
procedure CropPNG(Source: TPngImage; Left, Top, Width, Height: Integer; out Target: TPngImage);
Crops a region of the given position and size out of a PNG.
DrawBitmapCapInsetsuMlComm.pas
procedure DrawBitmapCapInsets(SrcBitmap, DestBitmap: TBitmap32; const CapInsetsRect: TRect ; Blend: Boolean = False);
Draws a bitmap onto another using nine-slice scaling, with CapInsetsRect giving the unstretched margins.
ResizeHorzImguMlComm.pas
function ResizeHorzImg(const Src: TMlSkinImage; const Width: Integer; const LeftRightSize: Integer = 0): TMlSkinImage;
Stretches an MLSkin image horizontally to a width.
ResizeHorzPnguMlComm.pas
function ResizeHorzPng(const Src: TPngImage; const Width: Integer; const LeftRightSize: Integer = 0): TPngImage;
Stretches a PNG horizontally to a width, keeping LeftRightSize pixels at each end unstretched.
ResizeImguMlComm.pas
function ResizeImg(const Src: TMlSkinImage; Width, Height: Integer): TMlSkinImage;
Scales an MLSkin image to the given width and height.
ResizePnguMlComm.pas
function ResizePng(const Src: TPngImage; Width, Height: Integer): TPngImage;
function ResizePng(const Src: TPngImage; const Width, Height: Integer; const HStretchRect, VStretchRect: TRect): TPngImage;
Scales a PNG to a given size. The overload with HStretchRect and VStretchRect stretches only the middle, leaving the edges and corners intact — nine-slice scaling.
ResizeVertImguMlComm.pas
function ResizeVertImg(const Src: TMlSkinImage; const Height: Integer): TMlSkinImage;
Stretches an MLSkin image vertically to a height.
ResizeVertPnguMlComm.pas
function ResizeVertPng(const Src: TPngImage; const Height: Integer): TPngImage;
Stretches a PNG vertically to a height.
SpliteHorz3ImguMlComm.pas
function SpliteHorz3Img(const Src: TMlSkinImage; const LeftRightSize: Integer = 0): TDynMlSkinImage;
Cuts an MLSkin image into three horizontal parts, with LeftRightSize giving the width of the ends.
SpliteImguMlComm.pas
function SpliteImg(const Src: TMlSkinImage; Count: Integer): TDynMlSkinImage;
Splits a multi-frame image vertically into that many MLSkin images — this is how multi-state button artwork is taken apart.
SpliteImgCenterPartuMlComm.pas
function SpliteImgCenterPart(const Src: TMlSkinImage; h: Integer; w: Integer): TMlSkinImage;
Takes the middle section of an image and scales it to the given size.
SpliteImgTo9BlockuMlComm.pas
function SpliteImgTo9Block(const Src: TMlSkinImage): TImgArray9Block;
Cuts an image into the nine pieces of a nine-slice grid, for stretching without distorting the corners.
SplitePnguMlComm.pas
function SplitePng(const Src: TPngImage; Count: Integer): TPngArray;
Splits a multi-frame PNG into that many separate PNGs.
SplitePngTo3horzBlockuMlComm.pas
function SplitePngTo3horzBlock(const Src: TPngImage): TPngArray3Block;
function SplitePngTo3horzBlock(const Src: TPngImage; const LeftRightSize: Integer): TPngArray3Block;
Cuts a PNG into left, middle and right parts, with the middle meant to stretch.
SplitePngTo3vertBlockuMlComm.pas
function SplitePngTo3vertBlock(const Src: TPngImage): TPngArray3Block;
Cuts a PNG into top, middle and bottom parts.
SplitePngTo9BlockuMlComm.pas
function SplitePngTo9Block(const Src: TPngImage): TPngArray9Block;
Cuts a PNG into the nine pieces of a nine-slice grid.
SpliteVertImguMlComm.pas
function SpliteVertImg(const Src: TMlSkinImage; Count: Integer): TDynMlSkinImage;
Splits a multi-frame image horizontally into that many parts.
Drawing helpers
ColorBlenduMlComm.pas
procedure ColorBlend(const ACanvas: HDC; const ARect: TRect; const ABlendColor: TColor; const ABlendValue: Integer);
Blends a translucent colour over a region of a canvas; ABlendValue is the strength.
DrawEffectTextuMlComm.pas
procedure DrawEffectText(const Canvas: TCanvas; ARect: TRect; const Text: string; const Flags: cardinal; const ShadowDistance: Integer = 0; const ShadowColor: TColor = $FFFFFE; BlurRadius: Integer = 5; const TextVisible: Boolean = True);
Draws text with effects such as a shadow or a glow: ShadowDistance is the offset, ShadowColor the colour and BlurRadius the blur.
DrawImageInCircleuMlComm.pas
procedure DrawImageInCircle(DC: HDC; const ACircleRect: TRect; AGPImage: TGPImage; const BgColor: TColor = $00EBB71C);
Draws an image clipped to a circle — the way round avatars are produced.
DrawParentImageuMlComm.pas
procedure DrawParentImage(Control: TControl; Dest: TCanvas; const ARect: TRect);
procedure DrawParentImage(Control: TControl; Dest: TBitmap32; const ARect: TRect);
Paints the parent background straight onto a bitmap or canvas, which is what makes a control look transparent.
DrawRoundRectangleuMlComm.pas
procedure DrawRoundRectangle(var ACanvas: TCanvas; const R: TRect; const AColor: TColor; const Radius: Integer);
Draws a rounded rectangle with the given corner Radius.
FillGradientuMlComm.pas
procedure FillGradient(Canvas: TCanvas; Color1, Color2: TColor; rect: TRect; const Horizontal: Boolean = True);
Fills a rectangle with a two-colour gradient; Horizontal picks the direction.
GetParentImageuMlComm.pas
procedure GetParentImage(Control: TControl; Dest: TCanvas; const ARect: TRect);
procedure GetParentImage(Control: TControl; Dest: TBitmap32; const ARect: TRect);
Grabs the parent background behind a control into a bitmap or canvas — this is how transparent controls get their backdrop.
MlBoxBluruMlComm.pas
procedure MlBoxBlur(Src: TBitmap; radius, rep: Integer);
Blurs a bitmap: radius is the blur radius and rep how many passes — more passes look closer to a Gaussian blur.
SetAlphaBlendTransparentuMlComm.pas
procedure SetAlphaBlendTransparent(WHandle: HWND = 0; Value: Byte = 0);
Sets the overall transparency of a layered window; Value runs from 0 to 255.
Colours & geometry
GetMonitorWorkAreauMlComm.pas
function GetMonitorWorkArea(const w: HWND; const WorkArea: Boolean): TRect;
Returns the bounds of the monitor a window is on; with WorkArea True it excludes the taskbar. Useful when positioning popups.
GetRectHeightuMlComm.pas
function GetRectHeight(const rect: TRect): Integer;
function GetRectHeight(const rect: TFloatRect): TFloat;
Returns the height of a rectangle; an overload accepts a float rectangle.
GetRectWidthuMlComm.pas
function GetRectWidth(const rect: TRect): Integer;
function GetRectWidth(const rect: TFloatRect): TFloat;
Returns the width of a rectangle; an overload accepts a float rectangle.
IsNullRectuMlComm.pas
function IsNullRect(R: TRect): Boolean;
Tests whether a rectangle is empty.
NullRectuMlComm.pas
function NullRect: TRect;
Returns an empty rectangle with all four values set to zero.
PointInRectuMlComm.pas
function PointInRect(R: TRect; P: TPoint): Boolean;
Tests whether a point lies inside a rectangle.
RectHeightuMlComm.pas
function RectHeight(const ARect: TRect): Integer;
Returns the height of a rectangle.
RectInRectuMlComm.pas
function RectInRect(R1, R2: TRect): Boolean;
Tests whether two rectangles overlap.
RectWidthuMlComm.pas
function RectWidth(const ARect: TRect): Integer;
Returns the width of a rectangle.
TColor2RGBuMlComm.pas
procedure TColor2RGB(const Color: TColor; var R, G, B: Byte);
Splits a TColor into its red, green and blue components.
WebColorToDelphiTColoruMlComm.pas
function WebColorToDelphiTColor(webcolor: Integer): TColor;
Converts a web colour value such as 0xRRGGBB into a Delphi TColor — handy when picking colours from a design.
Skin & resources
BringToFrontExuMlComm.pas
procedure BringToFrontEx(const DestWindow: THandle);
Brings a window to the front and activates it.
DisableVclStylesuMlComm.pas
procedure DisableVclStyles(Control: TControl);
Turns VCL Styles off for a control, which resolves conflicts between Delphi's styles and the skin drawing.
ExistsMlSkinResDMuMlSkinLinkResDM.pas
function ExistsMlSkinResDM: Boolean;
Tells whether the project already has the MLSkin resource data module.
GetMlSkinImageBytesuMlSkinResManager.pas
function GetMlSkinImageBytes(Image: TMlSkinImage): Int64;
Returns how many bytes an MLSkin image occupies, useful when tracking memory use.
GetMlSkinInstallPathuMlComm.pas
function GetMlSkinInstallPath: string;
Returns the MLSkin installation path, read from the registry.
GetMlSkinResDMuMlSkinLinkResDM.pas
function GetMlSkinResDM: TMlSkinResDM;
Returns the project's MLSkin resource data module, creating it when necessary.
ReloadMlSkinResDMuMlSkinLinkResDM.pas
procedure ReloadMlSkinResDM;
Reloads the images in the resource data module — call it after swapping the skin file.
TMlSkinResManagerObjuMlSkinResManager.pas
function TMlSkinResManagerObj: TMlSkinResManager;
Returns the global image resource manager, so images can be read and written by ID from code.
Text & strings
CalcTextHeightWuMlComm.pas
function CalcTextHeightW(DC: HDC; Str: WideString): Integer;
Measures the height of a string in pixels for a given device context.
CalcTextWidthWuMlComm.pas
function CalcTextWidthW(DC: HDC; Str: WideString): Integer;
Measures the width of a string in pixels for a given device context.
ExtractBetweenStringsuMlComm.pas
function ExtractBetweenStrings(AStrings: TStrings; var ResultStrings: TStrings; const StartStr, EndStr: string; CaseSensitive: Boolean = True): Boolean;
Extracts the content between two markers from a string list.
FillStrToLabelsuMlSkinTagsBox.pas
procedure FillStrToLabels(Dest: TMlTagsBoxItems; Source: string);
Splits a string back into the chips of a tags box — the counterpart of LabelsToStr.
GetPYCodeuMlPYCode.pas
function GetPYCode(stText: AnsiString; iMode: Integer): string;
Returns the pinyin code of a Chinese string — this is what drives the pinyin filter in the search edit. iMode chooses between initials and full pinyin.
HTMLDeleteTaguMlSkinHtmlLabel.pas
function HTMLDeleteTag(const Str: string): string;
Strips HTML tags from a string, leaving the plain text.
HTMLPrepareTextuMlSkinHtmlLabel.pas
function HTMLPrepareText(const Text: string): string;
Escapes plain text so it can be dropped safely into the HTML label control.
IsIntStringuMlComm.pas
function IsIntString(const Str: string): Boolean;
Tests whether a string is an integer.
LabelsToStruMlSkinTagsBox.pas
function LabelsToStr(Dest: TMlTagsBoxItems): string;
Joins all chips of a TMlSkinTagsBox into one string, which makes them easy to save.
ReadUTF8FileuMlComm.pas
function ReadUTF8File(const FileName: string): string;
Reads a text file as UTF-8.
WriteUTF8FileuMlComm.pas
procedure WriteUTF8File(const AStr, FileName: string);
Writes text to a file as UTF-8.
Other
CopyCanvasRegionToBitmapuMlComm.pas
function CopyCanvasRegionToBitmap(SourceCanvas: TCanvas; const SourceRect: TRect): TBitmap;
Copies a region of a canvas into a bitmap.
FormToBitmap32uMlSkinHint.pas
function FormToBitmap32(DestForm: TForm): TBitmap32;
Captures the whole form into a bitmap, for screenshots or transition effects.
GetAbsolutePathExuMlComm.pas
function GetAbsolutePathEx(BasePath, RelativePath: string): string;
Resolves a relative path against a base path into an absolute one.
GetSimpleTimerActiveCountuMlSimpleTimer.pas · uSimpleTimer.pas
function GetSimpleTimerActiveCount: Cardinal;
function GetSimpleTimerActiveCount: Cardinal;
Returns how many of those lightweight timers are currently running.
GetSimpleTimerCountuMlSimpleTimer.pas · uSimpleTimer.pas
function GetSimpleTimerCount: Cardinal;
function GetSimpleTimerCount: Cardinal;
Returns how many lightweight timers exist. MLSkin drives its animations with them, so this is useful when checking performance.
No matching function.