Hi Guys,
Could you please let me know how I can stop highlighting function in combobox?
I just like to can select the items without that blue color!
Thanks alot
Could you please let me know how I can stop highlighting function in combobox?
I just like to can select the items without that blue color!
Thanks alot
Jean PaulPosted Feb 24, 2011, 8:53 AM
Please try the following steps:
- Create a new windows forms application
- Place a combobox on it and change the property DrawMode to OwnerDrawVariable
- On the combox DrawItem event add the following code
private void comboBox1_DrawItem(object sender, DrawItemEventArgs e)
{
ComboBox combo = sender as ComboBox;
e.Graphics.FillRectangle(new SolidBrush(combo.BackColor), e.Bounds);
e.Graphics.DrawString(combo.Items[e.Index].ToString(), e.Font, new SolidBrush(combo.ForeColor), new Point(e.Bounds.X, e.Bounds.Y));
}
Now add some items to the combo box and test it
Hope this will help you..
Regards,
Jean Paul