I need black forecolor in a disabled combobox. Is it possible?
All you need to do is say
combobox1.ForeColor = Color.FromName("Black");
It doesn't matter if the control is disabled or not, it should change the foreground color.
Hi,
Not sure if your app is Winforms or WPF. The code given below works in a WPF app.
combo1.Items.Add("Item 1");
combo1.Items.Add("Item 2");
combo1.SelectedIndex = 0;
combo1.Foreground = Brushes.Black;
In my XAML I added a combo box and set its IsEnabled property to "false" then in the code behind I used the code given above and it does work.
HTH
I have searched around for information in the past about this, and as far as I can tell, the best solution is to change the DrawMode of the combo box to OwnerDrawFixed or OwnerDrawVariable and then write your own drawing code in the DrawItem event of the combo box.
I found this article that goes into much more detail about it. Hope it helps.
A "hack" I've used in the past for textboxes is to leave the control enabled, but capture the "OnFocus" event and immediately set the focus to some other object on the form, preferably a label since it doesn't show as being selected. I think this should work for comboboxes, too.