Skip to main content

TdxCustomColorEditProperties.OnGetCustomColorSet Event

Enables you to customize palette colors.

Declaration

property OnGetCustomColorSet: TdxColorGetCustomColorSetEvent read; write;

Remarks

This event is fired only if the ColorSet property is set to csCustom, before the currently selected color palette is populated with colors.

Sender specifies the color editor.

ASet contains a set of colors to be used for populating the color palette. The number of colors in ASet varies, depending upon the color palette, as described below:

  • For the cpOffice color palette, the set contains 20 colors (including 10 theme colors and 10 standard colors);

  • For the cpExtended and cpStandard color palettes, the set contains 40 and 15 colors, respectively.

You can customize these colors as required to display your own color palettes.

The following code shows how to swap standard and theme colors in the cpOffice color palette:

uses
  ..., dxCore;
//...
procedure <Form>.<dxColorEdit>GetCustomColorSet(Sender: TObject; var ASet: TColors);
const
  ThemeColorCount = 10;
var
  I: Iteger;
  AThemeColor: TColor;
begin
  for I := 0 to ThemeColorCount - 1 do
  begin
    AThemeColor := ASet[I];
    ASet[I] := ASet[I + ThemeColorCount];
    ASet[I + ThemeColorCount] := AThemeColor;
  end;
end;

The image below shows the resulting color palette.

See Also