MyTree.cpp
上传用户:nbkytg
上传日期:2021-02-14
资源大小:126k
文件大小:1k
- // MyTree.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ctreecontrolbar.h"
- #include "MyTree.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // MyTree
- MyTree::MyTree()
- { m_uFlags=0;
- }
- MyTree::~MyTree()
- {
- }
- BEGIN_MESSAGE_MAP(MyTree, CTreeCtrl)
- //{{AFX_MSG_MAP(MyTree)
- ON_WM_LBUTTONDOWN()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // MyTree message handlers
- void MyTree::OnLButtonDown(UINT nFlags, CPoint point)
- {
- // TODO: Add your message handler code here and/or call default
- HTREEITEM hItem =HitTest(point, &m_uFlags);
- //进行的是与运算,对于 二进制数来说都为1的情况下结果为1
- if ( (m_uFlags&TVHT_ONITEMLABEL ))
- {
-
- CCTreeControlBarApp *pApp=(CCTreeControlBarApp *)AfxGetApp();
- pApp->pView->m_Title=GetItemText(hItem);;
- pApp->pView->Invalidate(TRUE);
- SelectItem(hItem);
- }
-
- CTreeCtrl::OnLButtonDown(nFlags, point);
- }