ImageEn, unit iexColorPalette

TIEColorPalette.SelectedColor

TIEColorPalette.SelectedColor

Declaration

property SelectedColor: TColor;

Description

Specifies the color that is currently selected (down).
If nothing is selected, clNone is returned.

Note:
Setting SelectedColor to a color will only succeed if the color exists in the palette. To find the nearest color, use SelectNearestColor
TIEColorPalette does not support multiple selection

Example

// Show the selected color
pnlSelectedColor.ParentBackground := False;
pnlSelectedColor.Color := ColorPalette1.SelectedColor;

// Allow the selected color to be changed
procedure TForm1.pnlSelectedColorClick(Sender: TObject);
var
  palDlg:  TImageEnPaletteDialog;
begin
  palDlg := TImageEnPaletteDialog.Create( Self );
  palDlg.SetPalette( ColorPalette1.Palette, ColorPalette1.ColorCount);
  if palDlg.Execute then
    ColorPalette1.SelectedColor := PDialog.SelCol;
  palDlg.Free();
end;

See Also

SelectedIndex