Hello,
I have a TsComboBox in which I want to show some items disabled, let's say grayed out. “Disabled” does not mean that it can't be selected! My question is, how to do this? I can't simply use colors like clWindowText and clGrayText as these colors do not match perhaps the current skin style. By now my code looks like this:
Code:
procedure TMyForm.comboBoxDrawItem(Control: TWinControl;
Index: Integer; Rect: TRect; State: TOwnerDrawState);
var
comboBox: TsComboBox;
begin
comboBox := TsComboBox(Control);
comboBox.Canvas.FillRect(Rect);
if not (odSelected in State) then
begin
if not comboBox.DroppedDown
and (Index = comboBox.ItemIndex)
and GrayedOutCondition then
comboBox.Canvas.Font.Color := clGrayText
else
comboBox.Canvas.Font.Color := clWindowText;
end;
comboBox.Canvas.TextOut(Rect.Left+2, Rect.Top, coItems.Items[Index]);
end;
where GrayedOutCondition is my condition for showing the item disabled.
What do I have to do, which colors do I have to use, for the font and also for the background?
Many thanks in advance
Friedemann