我想做到金山毒霸那样的效果,一点根节点就自动SetCheck它的所有子节点,但是查来查去,都好像没有这个Event,OnClick时判断也不行,因为那个CheckBox不是在Item里面的。怎样才能知道呢这个事件呢?

解决方案 »

  1.   

    你用setcheck不行吗?按逻辑上应该可行。
    下面可能有你需要的,很不错的
    http://www.codeproject.com/treectrl/
    http://www.vckbase.com/code/listcode.asp?mclsid=3&sclsid=321
    http://www.codeguru.com/treeview/index.shtml
      

  2.   

    谢谢,SetCheck肯定可以,但是我需要的是TreeCtrl被人工SetCheck的时候所触发的事件。我是查过包括上述三个网页的内容之后,发现没有,才到这里提问的。
      

  3.   

    CTreeCtrl::GetItemState
    UINT GetItemState( HTREEITEM hItem, UINT nStateMask ) const;Return ValueA UINT specifying the item’s state. For information on possible values, see CTreeCtrl::GetItem.ParametershItemHandle of the item whose state is to be retrieved.nStateMaskMask indicating which states are to be retrieved. For more information on possible values for nStateMask, see the discussion of the state and stateMask members of theTVITEM structure in the Platform SDK.ResReturns the state of the item specified by hItem
      

  4.   

    楼上贴一段MSDN的内容是什么意思呢?问题我已经解决,自己处理两个消息,OnClick和OnKeydownOnClick那里用HitTest检查 uFlag & TVHT_ONITEMSTATEICON 
    OnKeyDown那里检查 VKSPACE