ComboBox item text colors

tiger03

Member
Joined
Jun 3, 2006
Messages
7
Programming Experience
Beginner
Hi,
I have got a combobox which retrieves its data from a dataset:
VB.NET:
Private dvsItem As DataView
dvsItem = New DataView(MainForm.TempPrice.TempPriceBook.Copy)
dvsItem.Sort = "ItemCode"
cbItem.DataSource = dvsItem
cbItem.DisplayMember = "ItemCode"
cbItem.ValueMember = "ItemCode"
I would like to have it so that, within the ComboBox itself, different items are colored differently. Is this possible? I tried making a little project just to test this, and looks to me like that I can only set the font color of all items and not apply colors selectivley.
Thanks
 
Last edited:
I've removed your attachment. If you're going attach projects please make sure you remove all binaries first, i.e. the "bin" and "obj" folders. Also, I'd encourage you to avoid unnecessary attachments. You're not asking us to fix something that's wrong, for which we would need to see your code. Even if you were, the first option should be to post the specific code that is causing the issue directly, rather than attaching entire projects.

What you need to do is draw the items yourself. You should read the documentation for the DrawMode property.
 
...Okay. I have found my solution by setting the DrawMode to OwnerDrawFixed, and making my own ComboBox1_DrawItem which handles ComboBox1.DrawItem.
 
Back
Top