Change forecolor of disabled combobox

I need a black forecolor in a disabled combobox. Is it possible?

+6
c # colors winforms combobox
source share
5 answers

In the past, I searched for information about this, and as far as I can tell, the best solution is to change DrawMode in the OwnerDrawFixed or OwnerDrawVariable combo box, and then write your own drawing code in the DrawItem event in the combo box.

I found this article an article that contains more detailed information about this. Hope this helps.

+4
source share

The โ€œhackโ€ that I used in the past for text fields is to leave the control turned on, but to capture the โ€œOnFocusโ€ event and immediately set focus to some other object in the form, preferably a shortcut, since itโ€™s not " t appears as selected. I think this should work for comboboxes too.

+4
source share

Not sure if your application is Winforms or WPF. The code below works in a WPF application.

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, and then in the code I used the code above, and it works.

NTN

-one
source share

All you have 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.

-2
source share

comboBox1.BackColor = Color.Black;

-3
source share

All Articles