softtouch 9 Posted April 17 I have a TComboBoxEx with items in it. Each item has an icon assigned, so far so good. When I click into the editbox to enter a new item name, there is no icon of course, but instead a weird space to the left (see attached image). Is there any way to have a default icon displayed in the editbox of the TComboBoxEx? Share this post Link to post
DelphiUdIT 176 Posted April 17 (edited) EDIT: This is for TComboBox, I never used TComboBoxEx and I don't know if that I suggest is working with that component. You can use OnDrawItem to draw what you want this is an example that draw a flag (form an array of pngimages), you have to see if you can also use this method for the Edit position: //FlagListPNG is a list of pngimages //NameLangLisTXT is a list of string (name of the languages) //You must adapt of course at your use procedure TLanguageSelect.ComboBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); begin try TComboBox(Control).Canvas.Draw(Rect.Left + 8, Rect.Top + (Rect.Height div 2 - FlagListPNG[Index].Height div 2), FlagListPNG[Index]); TComboBox(Control).Canvas.TextOut(Rect.Left + 8 + FlagListPNG[Index].Width + 8, Rect.Top, NameLangListTXT[Index]+' '); except TComboBox(Control).Canvas.TextOut(Rect.Left + 10, Rect.Top, NameLangListTXT[Index]); end; end; Edited April 17 by DelphiUdIT Share this post Link to post