資源描述:
《CTreeCtrl的拖拽功能》由會員上傳分享,免費在線閱讀,更多相關內(nèi)容在行業(yè)資料-天天文庫。
1、[MFC編程]一個具有拖拽功能的TreeCtrl??2011-05-0722:37:20
2、??分類:?MFC編程
3、舉報
4、字號?訂閱#if!defined(AFX_DRAGTREE_H__3015F03F_045E_4531_A436_E2A890F23540__INCLUDED_)#defineAFX_DRAGTREE_H__3015F03F_045E_4531_A436_E2A890F23540__INCLUDED_#if_MSC_VER>1000#pragmaonce#endif//_MSC_VER>1000//DragTree.h:headerfile/////////
5、////////////////////////////////////////////////////////////////////////CDragTreewindowclassCDragTree:publicCTreeCtrl{//Constructionpublic:?CDragTree();??CImageList*?m_pDragImages;?//拖動的圖像列表?BOOLm_bDrag;????//是否進行拖動?HTREEITEM?m_hBeginDrag;?//拖動的起點//Attributespublic://Operationspublic://Over
6、rides?//ClassWizardgeneratedvirtualfunctionoverrides?//{{AFX_VIRTUAL(CDragTree)?//}}AFX_VIRTUAL//Implementationpublic:?voidCopyNodes(HTREEITEMhDesItem,HTREEITEMhSrcItem);?virtual~CDragTree();?//Generatedmessagemapfunctionsprotected:?//{{AFX_MSG(CDragTree)?afx_msgvoidOnBegindrag(NMHDR*pNMHDR
7、,LRESULT*pResult);?afx_msgvoidOnMouseMove(UINTnFlags,CPointpoint);?afx_msgvoidOnLButtonUp(UINTnFlags,CPointpoint);?//}}AFX_MSG?DECLARE_MESSAGE_MAP()};///////////////////////////////////////////////////////////////////////////////{{AFX_INSERT_LOCATION}}//MicrosoftVisualC++willinsertadditiona
8、ldeclarationsimmediatelybeforethepreviousline.#endif//!defined(AFX_DRAGTREE_H__3015F03F_045E_4531_A436_E2A890F23540__INCLUDED_)?//DragTree.cpp:implementationfile//#include"stdafx.h"#include"DragTreeItem.h"#include"DragTree.h"#ifdef_DEBUG#definenewDEBUG_NEW#undefTHIS_FILEstaticcharTHIS_FILE[
9、]=__FILE__;#endif///////////////////////////////////////////////////////////////////////////////CDragTreeCDragTree::CDragTree(){?m_pDragImages=NULL;?m_bDrag=FALSE;?m_hBeginDrag=NULL;}CDragTree::~CDragTree(){}BEGIN_MESSAGE_MAP(CDragTree,CTreeCtrl)?//{{AFX_MSG_MAP(CDragTree)?ON_NOTIFY_REFLECT
10、(TVN_BEGINDRAG,OnBegindrag)?ON_WM_MOUSEMOVE()?ON_WM_LBUTTONUP()?//}}AFX_MSG_MAPEND_MESSAGE_MAP()///////////////////////////////////////////////////////////////////////////////CDragTreemessagehandlersvoidCDragTree::OnBegindrag(NMHDR*pNMHDR,LRESULT*pResult