Updated: Dec 16, 2023
Follow on twitter

Changing of selection color in the run-time.

Developer can change colors in any section of loaded skin at the real-time.

We should search an index of section, used for drawing of selected area ('SELECTION') and change properties of this section:

var SectionIndex: integer; begin // Search index of section in the current loaded skin SectionIndex := sSkinManager1.GetSkinIndex('SELECTION'); if SectionIndex >= 0 then begin State := 0; // Normal state sSkinManager1.gd[SectionIndex].Props[State].Color := clRed; // Normal selection color State := 1; // Active state sSkinManager1.gd[SectionIndex].Props[State].Color := clMaroon; // Focused selection color end; end;

Using same way may be changed font color and other properties.

List of standard names of skin sections may be found in the sSkinProps.pas file.

Also, selection color must be changed in the skin common palette:

sSkinManager1.Palette[pcSelectionBG] := clRed; // Normal selection color sSkinManager1.Palette[pcSelectionBG_Focused] := clMaroon; // Focused selection color

Selected area is drawn by OS in some components, using current OS colors. It's possible to change system colors in application, use the sSkinManager1.Options.ChangeSysColor property for that. Sys colors will be received from the current skin in this case.

Download the demo project






Installing, using and licensing the demo programs © Sergii Goncharov, Ukraine, Odessa 2004-2023