LMD DockingPack Guide


Understanding Styles


To control visual style of the docking sites and floating forms TLMDDockManager component should be used. The component contains StyleName property, which has a drop-down list of supported at design-time styles. For example, you can select VS2010 style to achieve Microsoft Visual Studio 2010 like style.

 

Starting from LMD 2013 version LMD DockingPack has fully re-implemented styles system. New engine is based on stretchable 32-bit bitmaps with support of alpha channel. The style itself is represented by two files:

 

Master bitmap: contains images for all elements in a single 32-bit bitmap.

XML style description: contains element layers description, master bitmap region coordinates, stretch margins values, other property values of style elements.

 

Despite the fact that new engine is currently used for LMD DockingPack only, its designed to be universal, object oriented and strongly typed. Elements are defined as sub-classes of the base element class. The engine support steaming of published properties of simple types using Delphi RTTI; as a result an element can define and use its own properties and states (parts). For an example of what elements are and how they looks like, please take a look at LMDDckStyleElems.pas source file.

 

Its perfectly valid to define more elements for use it custom control, or even for use in custom application painting. However, it should be noted that the engine is experimental in many aspects and likely will be changed dramatically in the next versions.

 

Custom styles

 

If built-in styles are not suitable for an application, a custom style can be defined. Starting from LMD VCL 2014 version, special style editor application can be used for custom styles creation. However, a style can also be created manually; probably, its will be simpler to start by changing one of the existing styles. To create custom style:

 

Create new or copy existing master bitmap and XML description files.

Use suitable image editor for changing master bitmap. Note that the image editor should support 32-bit bitmaps and provide the ability to work with alpha channel. We recommend PixelFormer small and handy image editor.

Use suitable text editor, for example, Delphi code editor to change XML description. Look at existing styles to understand how element properties and states can be specified.

Load created style at run-time.

 

Custom style can be loaded at run-time using the code like this:

 

var

  style: TLMDDockStyle;

begin

  style := DockStyles.Add('MyStyleName');

  style.LoadFromFile('MyStyle.xml');

  MyDockManager.Style := style;

end;

 

Generally, the style can be loaded from:

 

File: using TLMDDockStyle.LoadFromFile method; Master bitmap file should be places in the same directory as XML file and should be named identically (except "bmp" extension).

Resource: TLMDDockStyle.LoadFromResource method. Style should exists as two resources with <AResName>_XML and <AResName>_BMP names.

Anywhere: descend from TLMDStyleSource class and override streaming. Use DockStyles.Add overloaded method, which takes style source parameter or use TLMDDockStyle.Load method.