处理CListCtrl鼠标点击的问题
我有一个带有复选框的 listctrl(LVS_EX_CHECKBOXES)。它是一个单列列表控件。我的问题是,当我单击复选框时,特定项目被选中/取消选中。但是,当我单击项目文本时,相应的复选框没有被选中/取消选中。如何处理这两种情况。
I have a listctrl with CheckBox in it(LVS_EX_CHECKBOXES) .It is a single column List Control . My Problem is when I Click on the CheckBox the particular item is getting selected/UnSelected. But when I click on the Item text the corresponding Checkbox is not getting Selected/UnSelected . How to handle both the Scenarios.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要在用户单击项目文本时检查该项目,您必须处理 NM_CLICK 消息,每当用户单击该项目时都会发送该消息。
大致如下:
我在编写此内容时没有进行测试,因此您必须确保它不会与单击复选框本身的处理程序发生冲突。
To check the item when the user clicks on the item text, you'll have to handle the NM_CLICK message, which is sent whenever the user clicks on the item.
Something along the lines of:
I'm writing this without testing though, so you'll have to make sure that it doesn't conflict with the handler for clicks on the check box iteself.