JiaYu_Guo 2018-09-20 08:39 采纳率: 0%
浏览 586
已采纳

MFC treecontrol 复选框问题 怎么判断点击的是文字还是文字前面的复选框?

MFC treecontrol 复选框问题 怎么判断点击的是文字还是文字前面的复选框?图片说明

  • 写回答

2条回答 默认 最新

  • threenewbee 2018-09-20 10:49
    关注
     void CQ700626Dlg::OnClickTree1(NMHDR *pNMHDR, LRESULT *pResult)
    {
        // TODO: Add your control notification handler code here
        NM_TREEVIEW* pHdr = (NM_TREEVIEW*)pNMHDR;  
        *pResult = 0;  
    
        CPoint point;  
        UINT uFlag;  
        GetCursorPos(&point);  
        ScreenToClient(&point);  
    
        HTREEITEM item = m_tree.HitTest(point, &uFlag);  
        if (point.x > 30)
            MessageBox(_T("click the text"), NULL, 0U);
        else
            MessageBox(_T("click the box"), NULL, 0U);
    
        *pResult = 0;
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?