禁用列表框项 [英] Disable ListBox items

查看:132
本文介绍了禁用列表框项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,有没有办法使ListBox控件中的特定项目灰显/禁用?

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.

任何人都得到了一些建议,我应该如何做?还是可以使用ListBox做到这一点?

Anyone got some advices how I should do this? Or is there some way to do it with ListBox?

推荐答案

您将需要进行自定义绘制来处理此问题.查找OwnerDraw

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.

另一种方法是在详细信息"视图模式下使用ListView.然后,您可以修改每个项目的前后颜色,字体等.

An alternative would be to use ListView in Details view mode. Then you can modify each item's fore/back colors, font, and more.

这篇关于禁用列表框项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆