Disable ListBox items

2019-08-21 12:48发布

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条回答
别忘想泡老子
2楼-- · 2019-08-21 13:19

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.

查看更多
登录 后发表回答