As far as I know, the only workaround for this problem is ownerdraw combobox
Try the following steps.
- Set the Style property for the
csOwnerDrawFixed combo csOwnerDrawFixed - In the OnDrawItem event, use the vcl styes methods to draw combobox elements.
Check out this sample code.
uses Vcl.Styles, Vcl.Themes, procedure TForm115.ComboBox1DrawItem(Control: TWinControl; Index: Integer; const ColorStates: array[Boolean] of TStyleColor = (scComboBoxDisabled, scComboBox); FontColorStates: array[Boolean] of TStyleFont = (sfComboBoxItemDisabled, sfComboBoxItemNormal); var LStyles : TCustomStyleServices; begin LStyles :=StyleServices; with Control as TComboBox do begin Canvas.Brush.Color := LStyles.GetStyleColor(ColorStates[Control.Enabled]); Canvas.Font.Color := LStyles.GetStyleFontColor(FontColorStates[Control.Enabled]); if odSelected in State then Canvas.Brush.Color := LStyles.GetSystemColor(clHighlight); Canvas.FillRect(Rect) ; Canvas.TextOut(Rect.Left+2, Rect.Top, Items[Index]); end; end;
For more information, you can check out this article by Vcl Styles and Owner Draw . You can also use the Vcl.Styles.OwnerDrawFix block (part of the vcl-styles -utils project ), which includes a set of owners, draws procedures for components such as TListBox, TComboBox and TListView.
Rruz
source share