16,472
社区成员
发帖
与我相关
我的任务
分享
// NM_CLICK消息
void CXXXDlg::OnClickTree1(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
CPoint pt;
GetCursorPos(&pt);
m_tree.ScreenToClient(&pt);
UINT uFlag = 0;
HTREEITEM hCurSel = m_tree.GetSelectedItem();
HTREEITEM hItem = m_tree.HitTest(pt, &uFlag);
if(hItem)
{
if(hCurSel != hItem)
{
m_tree.SelectItem(hItem);
}
CString strText(_T(""));
if(TVHT_ONITEMBUTTON & uFlag)
{
strText.Format(_T("On Button"));
}
else if(TVHT_ONITEMLABEL & uFlag)
{
strText.Format(_T("On Label"));
}
else
{
strText.Format(_T("On Others"));
}
AfxMessageBox(strText);
}
*pResult = 0;
}