-
October 10th, 2013, 12:18 PM
#1
Colored background dropdownlist in combobox
Hello, i have a problem with coloring background in combobox..
As you can see.. background is colored after mouse move on text.. what i should to do to get automatic colored background?
-
October 10th, 2013, 05:01 PM
#2
Re: Colored background dropdownlist in combobox
This works fine for me
Code:
void comboBox1_DrawItem(object sender, DrawItemEventArgs e)
{
if (e.Index < 0) return;
if (comboBox1.Items[e.Index].ToString().Contains(".99."))
e.Graphics.FillRectangle(new SolidBrush(Color.Red), (Rectangle)e.Bounds);
e.Graphics.DrawString(comboBox1.Items[e.Index].ToString(), e.Font, new SolidBrush(comboBox1.ForeColor), new Point(e.Bounds.X, e.Bounds.Y));
}
Probably your error is that you don't use the item index
-
October 10th, 2013, 05:10 PM
#3
Re: Colored background dropdownlist in combobox
Thanks a lot, its working fine now
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|