请告诉我在什么消息里可以截获checkbox被点击?这样就可以把其他的checkbox先置为非选中状态了。.txt

来自「Tips about VCampus project.rar我们的项目VCamp」· 文本 代码 · 共 20 行

TXT
20
字号
请告诉我在什么消息里可以截获checkbox被点击?这样就可以把其他的checkbox先置为非选中状态了。  
---------------------------------------------------------------  
 
 
有,在NM_CLICK消息中用CListCtrl::HitTest可以点到点击的地方是文字还是图标还是那个checkbox  
 
 
LVHT_ABOVE    The  position  is  above  the  control's  client  area.    
LVHT_BELOW    The  position  is  below  the  control's  client  area.    
LVHT_NOWHERE    The  position  is  inside  the  list-view  control's  client  window,  but  it  is  not  over  a  list  item.    
LVHT_ONITEMICON    The  position  is  over  a  list-view  item's  icon.    
LVHT_ONITEMLABEL  The  position  is  over  a  list-view  item's  text.    
LVHT_ONITEMSTATEICON  The  position  is  over  the  state  image  of  a  list-view  item.    
LVHT_TOLEFT    The  position  is  to  the  left  of  the  list-view  control's  client  area.    
LVHT_TORIGHT    The  position  is  to  the  right  of  the  list-view  control's  client  area    
如果是LVHT_ONITEMSTATEICON的话证明用户点击了那个checkbox,这时你可以检查该项的状态是选中还是没选中  
---------------------------------------------------------------  
 
也可以在OnLButtonDown中去处理!调用Hittest来判断出所选项,取消掉其他项的选中

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?