LMD GridPack Guide


VCL Styles


Starting from LMD-2014 version, LMD-Grid includes VCl Styles support. VCL Styles are built into VCL feature, which allows to select application's look&feel from the set of predefined styles (or themes). Usually included in application styles are specified in IDE project options (Ctrl+Shift+F11) in the Application|Appearance section.

 

LMD-Grid controls, as previously, use LMD-Themes interface for drawing purposes. So, ThemeMode property, which can be set to ttmPlatform or ttmNative is still supported. However, actual implementation of ttmPlatform mode has been extended to provide compatibility with VCL Styles system. So, the grid will automatically draw itself in a styled way if any style from VCL Styles has been activated and the ThemeMode is set to ttmPlatform:

 

clip0018

 

clip0019

 

clip0020

 

Basically, VCL Styles are element based style system, just like it was previously in XP themes. However, since the grid has no analog in standard Windows controls it actually, can't be drawn fully correct using styles system. So, when possible LMD-Grid tries to use style elements for drawing purposes; for example, column headers are painted using standard Windows Header control elements.

 

However, for all other cases LMD-Grid attempts to adapt standard system colors to match current style using provided by the styles system API (GetSystemColor, GetElementColor); for example, colors are used instead of style elements to draw grid lines, grid selection or grid cell background.

 

LMDGrid control has a lot of color properties, which are accessible at design-time, and most of them reside in a Grid.Style object. Its important to understand how grid control use the values of such properties in styled painting. The rule is simple:

 

When something can be drawn using element based drawing (such as column headers) - color properties values are ignored. This is the usual way, in which most other controls works.

However, when color based drawing is used (as described above) - color properties values are used for drawing in the following way:

oIf the color value is usual color like clRed, it used as is for drawing.

oIf the color value is a system color, such as clBtnFace, its value is modified to fit current style, and then used for drawing.

 

System color values modification provides some freedom for the user, allowing him to work in a style agnostic way. This way also allows us to provide consistent default values for all related color properties.