MFC 中CTreeCtrl 想右击然后使该项获得焦点,原来的失去焦点......
我的代码voidCMyTreeControlDlg::OnNMRclickTree1(NMHDR*pNMHDR,LRESULT*pResult){//TODO:在此添加控...
我的代码
void CMyTreeControlDlg::OnNMRclickTree1(NMHDR *pNMHDR, LRESULT *pResult)
{
// TODO: 在此添加控件通知处理程序代码
LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
HTREEITEM pSelected=pNMTreeView->itemNew.hItem;
HTREEITEM pOld=pNMTreeView->itemOld.hItem;
this->m_TreeCtrl.SetItemState(pOld,TVIS_SELECTED ,NULL);
this->m_TreeCtrl.SetItemState(pSelected,TVIS_SELECTED ,TVIS_SELECTED);
*pResult = 0;
}
右击没反应
好烦
我在这个函数里面写MessageBox的时候,右击可以弹出对话框的...
函数原型应该没错 展开
void CMyTreeControlDlg::OnNMRclickTree1(NMHDR *pNMHDR, LRESULT *pResult)
{
// TODO: 在此添加控件通知处理程序代码
LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
HTREEITEM pSelected=pNMTreeView->itemNew.hItem;
HTREEITEM pOld=pNMTreeView->itemOld.hItem;
this->m_TreeCtrl.SetItemState(pOld,TVIS_SELECTED ,NULL);
this->m_TreeCtrl.SetItemState(pSelected,TVIS_SELECTED ,TVIS_SELECTED);
*pResult = 0;
}
右击没反应
好烦
我在这个函数里面写MessageBox的时候,右击可以弹出对话框的...
函数原型应该没错 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询