Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Graying out specific items in a ComboBox?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I want to gray out specific items in the list portion of the ComboBox, is this possible? for instance, if my ComboBox has this as its data:

No Selection
One
Two
Three
Four

How would I be able to gray out "Two" and "Four", yet have the others active. I would even be willing to just change the text's coloring if that is all that can happen.
 
Hi

you could use the OnCtlColor to change the color of the background.
The listbox of the combobox is a special case of this message as the listbox of a combo is a child of the combo.
You should subclass the control and override the function OnCtlCOlor. You checl the last patameter and if it is equal to CTLCOLOR_LISTBOX, you can call function to change the background and the text color.

You can also check for an existing class that change the color of the items at the following page:



HTH
Thierry
EMail: Thierry.Marneffe@swing.be
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top