All, I have had an indepth look but can't seem to find what I am looking for. I want ot change the selection color of a ComboBoc control (ideally without having to sub-class the control). I though doing the following would work, but this event is not even firing
private void comboBoxDb_DrawItem(object sender, DrawItemEventArgs e)
{
ComboBox combo = sender as ComboBox;
e.Graphics.FillRectangle(new SolidBrush(combo.BackColor), e.Bounds);
string strSelectionColor = @"#99D4FC";
Color selectionColor =
System.Drawing.ColorTranslator.FromHtml(strSelectionColor);
e.Graphics.DrawString(combo.Items[e.Index].ToString(),
e.Font,
new SolidBrush(selectionColor),
new Point(e.Bounds.X, e.Bounds.Y));
}
but this event is not even firing. What am I doing wrong here?
Thanks for your time.
Edit. Although the non firing was caused by not setting the DrawMode property of the ComboBox correctly pointed out by @Teppic, this is still not doing what I require. I want to set the selection color, what I have done above does (I have blocked out names here)
Whereas I want to change the blue highlight ion the control as shown here.