procedure TForm1.sCheckListBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var IsSelected : boolean;
const ColorFieldWidth = 10;
const ColArr : array[0..3] of TColor = (clBlack, clRed, clBlue, clYellow);
begin
IsSelected:=odSelected in State;
with (Control as TsCheckListBox) do
begin
// Clear Cell
if IsSelected then
begin
Canvas.Brush.Color:=$00AED7FF;
Canvas.FillRect(Rect);
end;
// Draw Colorfield
Canvas.Brush.Color:=ColArr[Index mod 4];
with Rect do
Canvas.FillRect(Classes.Rect(Left+2,Top+2,Left+2+ColorFieldWidth,Bottom-3));
// Output Text
Canvas.Brush.Style:=bsClear;
Canvas.Font.Color:=clBlack;
with Rect do
Canvas.TextOut(Left+ColorFieldWidth+7, Top+1, Items[Index]);
end;
end;