TreeView中CheckBox的使用

1.选择TreeView的Check Boxes属性为真.

2.对Click事件,DoubleClick事件进行处理.

//在void CXXXDlg::OnNMClickXXX(NMHDR *pNMHDR, LRESULT *pResult) 中:

DWORD dwPos = GetMessagePos(); CPoint point( LOWORD(dwPos), HIWORD(dwPos));

m_TreeCtrl.ScreenToClient(&point);

UINT uFlags=0;

HTREEITEM hItem = m_TreeCtrl.HitTest(point, &uFlags);

if(hItem!=NULL)

{

         if(uFlags & TVHT_ONITEMSTATEICON) //点击的是节点前面的checkbox

          { m_TreeCtrl.SelectItem(hItem);

          if (m_TreeCtrl.GetCheck(hItem))

            { TRACE(m_TreeCtrl.GetItemText(hItem)); ... ...

你可能感兴趣的:(职场,checkbox,treeview,休闲)