有一些节点是必选的,不可更改。可选节点可以更改checkbox状态。请问如何实现?

解决方案 »

  1.   

    这个要自己点击item自己判断吧
      

  2.   

    重载树的ON_WM_LBUTTONDOWN()和ON_WM_KEYDOWN()两个消息相应函数
      

  3.   

    可以根据需要设置该项的状态吧!
    TVITEMEX 有个成员:
    uStateEx
    Version 6.00 and Windows Vista. One or more (as a bitwise combination) of the following extended states.TVIS_EX_DISABLED
    Creates a control that is drawn in grey, that the user cannot interact with.

    TVIS_EX_FLAT
    Creates a flat item— the item is virtual and is not visible in the tree; instead, its children take its place in the tree hierarchy.
    TVIS_EX_HWND
    Creates a separate HWND for the item.
      

  4.   

    要自己检测用户操作的是哪个item 
      

  5.   

    You can handle NM_CLICK & LVM_HITTEST with LVHT_ONITEMSTATEICON
    (return 1 to disable it)(+ change ImageList (LVSIL_STATE) for appearance)
      

  6.   


    我用的ctreectrl里没有这2个消息响应函数啊。不是全部不可改 是部分不能更改。这样的话是不是连选择checkbox的消息也屏蔽了
      

  7.   

    是WM_LBUTTONDOWN和WM_KEYDOWN,那个能响应,你总有判断标准吧。
      

  8.   


    在树控件的对话框的classwizzard中有这2个消息,树中没有啊