如何向复选框控件的子项中随机添加复选框 [英] How to add checkboxes to the sub items of listcontrol randomly
本文介绍了如何向复选框控件的子项中随机添加复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个listcontrol,在其中填充了2行4列的一些值.
当我添加LVS_EX_CHECKBOXES时,它仅将复选框添加到一列中,我的问题是我也如何将复选框添加到子项中.
我是怎么做的:
栏1 -------栏2 -------栏3 ------栏4
[] Item1 ------- SubItem1 ------ SubItem2 ----- SubItem3
[] Item2 -------- SubItem1 ------ SubItem2 ----- SubItem3
[]-复选框已启用
我要做的是:
栏1 -------栏2 -------栏3 ------栏4
[] Item1 ------- SubItem1 --- [] SubItem2 --- [] SubItem3
[] Item2 ------ [] SubItem1 --- [] SubItem2 ----- SubItem3
正如我在上面提到的,几个子项应具有复选框.
有人可以帮我吗:)
在此先感谢.
解决方案
您不能; ListView控件仅将复选框添加到主项(即列1),而不添加到子项.请参见将复选框添加到列表控件 ["XListCtrl-具有子项格式的自定义绘图列表控件" [ 解决方案
You can''t; the ListView control only adds checkboxes to the main item (i.e. column 1) not to the subitems. See Adding Checkboxes to a list control[^] for more information.
You could have a look at one (or more) of the manyListView
customizations available here atCode Project.
See, for instance: "XListCtrl - A custom-draw list control with subitem formatting"[^].
这篇关于如何向复选框控件的子项中随机添加复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文