Is it possible to remove some checkboxes from tree view's nodes?

后端 未结 1 1486
别那么骄傲
别那么骄傲 2020-12-20 06:31

I have made a tree view control in dialog box, using resource editor.

I have set the checkbox style with SetWindowLongPtr( ... ) function, the way Microsoft describe

1条回答
  •  时光说笑
    2020-12-20 07:14

    The tree control uses state images to draw the checkboxes. According to the docs on the TVS_CHECKBOXES style:

    State image 1 is the unchecked box and state image 2 is the checked box. Setting the state image to zero removes the check box altogether.

    So something like this should let you remove the check box from a tree item:

    TVITEM tvi;
    tvi.hItem = hTreeItem;
    tvi.mask = TVIF_STATE;
    tvi.stateMask = TVIS_STATEIMAGEMASK;
    tvi.state = 0;
    TreeView_SetItem(hWndTree, &tvi);
    

    0 讨论(0)
提交回复
热议问题