TColorListBox
From Lazarus wiki
Jump to navigationJump to searchThe printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
│
English (en) │
Esperanto (eo) │
suomi (fi) │
français (fr) │
русский (ru) │
A TColorListBox is a component that shows a (scrollable) list of colors from which the user can select one. It is available from the Additional tab of the Component Palette.
Specific properties of TColorListBox
are:
ColorRectOffset
- margin around each color rectangleColorRectWidth
- width of a color rectangleStyle
- defines the items shown in the listbox, and how the colors are namedcbStandardColors
- includes the 16 LCL standard colors in the list, e.g.clRed
orclBlue
cbExtendedColors
- includes the 4 LCL extended colors:clMoneyGreen
,clSkyBlue
,clCream
,clMedGray
cbSystemColors
- includes the OS- and theme-dependent system colorscbIncludeNone
- includes the special colorclNone
. Use the propertyNoneColorColor
to determine the replacement color. IfNoneColorColor
is set toclNone
the color rectangle displays a crossed-out box like in many drawing programs.cbIncludeDefault
- include the special colorclDefault
. PropertyDefaultColorColor
determines the actual color displayed.cbCustomColor
- the first listbox item is customizable by means of the standard color dialog.cbPrettyNames
- displays "pretty" color names next to the color boxes, e.g. 'Red'. Without this option the internal color names are used, e.g. 'clRed'.cbCustomColors
- includes user-provided colors at the end of the list. The colors must be defined by a stringlist in theOnGetColors
event, like this:
procedure TForm1.ColorListBox1GetColors(Sender: TCustomColorListBox; Items: TStrings);
begin
Items.AddObject('Gold', TObject(PtrInt($00D7FF)));
Items.AddObject('Chocolate', TObject(PtrInt($1E69D2)));
Items.AddObject('Light blue', TObject(PtrInt($E6D8AD)));
end;
See also