问题
As far as I know, there is no way to grey out/disable specific items in the ListBox control?
I want to make a list of surveys that need to be answered, but grey out/disable those that the user has already answered.
Anyone got some advices how I should do this? Or is there some way to do it with ListBox?
回答1:
You will need to do custom drawing to handle this. Look up OwnerDraw
The typical (and simpler) pattern is just to not include those items in the ListBox.
An alternative would be to use ListView
in Details view mode. Then you can modify each item's fore/back colors, font, and more.
来源:https://stackoverflow.com/questions/10435537/disable-listbox-items