colors on disabled combo boxes

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Hi,

I need to disable comboboxes for users with view only
permissions. However, that gray background just doesn't
do it for me. Is there a way to change the background /
text colors when disabled? Could anyone give me example
of specific code to do this?

Thanks,

M.
 
Mike said:
I need to disable comboboxes for users with view only
permissions. However, that gray background just doesn't
do it for me. Is there a way to change the background /
text colors when disabled? Could anyone give me example
of specific code to do this?

You will have to change the colors in the system's settings.
 
I had the same problem. I ended up creating my own combobox control that
was inherited from the System.Windows.Forms.ComboBox control. I added a new
property called ReadOnly. When ReadOnly is set to true, I set the BackColor
of the ComboBox to SystemColors.Control. I also overrode some events so
that the user couldn't change the value in the ComboBox when it was in
ReadOnly mode. The nice thing about it is that the user can still select
and copy the text in the ComboBox, which they can't do if the control is
actually disabled.
 
Back
Top