I am able to change the color of the items in DBCombobox using its Style as csOwnerDrawFixed similar to
How do I draw the selected list-box item in a different color?
procedure TForm1.DBComboBoxDrawItem(Control:TWinControl;
Index: Integer; Rect: TRect; State: TOwnerDrawState);
with (Control as TDBComboBox).Canvas do
begin
if odSelected in State then
Brush.Color := $00EACAB6;
Font.Color := clBlack;
FillRect(Rect);
TextOut(Rect.Left, Rect.Top, (Control as TDBComboBox).Items[Index]);
if odFocused In State then
begin
Brush.Color := (Control as TDBComboBox).Color;
DrawFocusRect(Rect);
end; {if}
end; {with}
end;
Generally, By default i am able to use the DBCombobox Standard (style :csDropdown) to choose the items and also to enter the text in DB Combobox
But the problem i am facing currently is, when i change the color of DBCombobox using (Style as csOwnerDrawFixed or csOwnerDrawVariable). The color gets changed but i am not able enter the text in DBCombobox.
Could someone tell me how can i change the color of items and could enter the text in the DBCombobox at the same time. Thanks !
Note: The Color Shown is not the default one but the modified one