TColorListBox
From Free Pascal wiki
Jump to navigationJump to search
│
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.clRedorclBluecbExtendedColors- includes the 4 LCL extended colors:clMoneyGreen,clSkyBlue,clCream,clMedGraycbSystemColors- includes the OS- and theme-dependent system colorscbIncludeNone- includes the special colorclNone. Use the propertyNoneColorColorto determine the replacement color. IfNoneColorColoris set toclNonethe color rectangle displays a crossed-out box like in many drawing programs.cbIncludeDefault- include the special colorclDefault. PropertyDefaultColorColordetermines 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 theOnGetColorsevent, 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
