Disable ListBox items

删除回忆录丶 提交于 2019-12-12 04:08:53

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!