Hey. I have a problem with the highlighter in ComboBox. Recently I had to gray out certain items in a ComboBox and I did that by manually (programitically) drawing strings in the ComboBox. In a .NET combobox under the DrawMode.NORMAL, the lighlighter will automatically come when you click the arrow and the backcolor of the highlighter will be kinna blue by default. The problem is when we move the mouse over a item the forecolor of the hovered item changes to white, but when we draw the items manually (DrawMode.OwnerDrawVariable) it dosen't work. Can you help me with this ??
This is how I grayed out items,
private void comboBox1_DrawItem(object sender, DrawItemEventArgs e)
{
e.DrawBackground();
int index = e.Index;
CombinationEntry aFunction = comboBox1.Items[index] as CombinationEntry; //CombinationEntry is a custom object to hold the gray info. Gray if not available and black if available
if (aFunction.myIsAvailable)
{
e.Graphics.DrawString(aFunction.ToString(), new Font("Arial", 10, FontStyle.Regular, GraphicsUnit.Pixel), Brushes.Black, new Point(e.Bounds.X, e.Bounds.Y));
}
else
{
e.Graphics.DrawString(aFunction.ToString(), new Font("Arial", 10, FontStyle.Regular, GraphicsUnit.Pixel), Brushes.Gray, new Point(e.Bounds.X, e.Bounds.Y));
}
}