⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 structuretree.cpp

📁 用数据库控制树型控件现实内容的例子
💻 CPP
字号:
// StructureTree.cpp : implementation file
//

#include "stdafx.h"
#include "Kill.h"
#include "StructureTree.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CStructureTree

CStructureTree::CStructureTree()
{
}

CStructureTree::~CStructureTree()
{
}


BEGIN_MESSAGE_MAP(CStructureTree, CTreeCtrl)
	//{{AFX_MSG_MAP(CStructureTree)
	ON_WM_CONTEXTMENU()
	ON_NOTIFY_REFLECT(NM_RCLICK, OnRclick)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CStructureTree message handlers


void CStructureTree::OnContextMenu(CWnd* pWnd, CPoint point)
{
 	// CG: This block was added by the Pop-up Menu component
	if (point.x == -1 && point.y == -1)
	{
 			//keystroke invocation
		point = (CPoint) GetMessagePos();
  	}

	ScreenToClient(&point);
	UINT uFlags;
	HTREEITEM htItem;
	htItem = HitTest( point, &uFlags );
	if( htItem == NULL )
		return;
	SelectItem(htItem);

	CMenu menu;
 	VERIFY(menu.LoadMenu(IDR_POPUP_TREE_MENU));
 
 	CMenu* pPopup = menu.GetSubMenu(0);
 	ASSERT(pPopup != NULL);
 	CWnd* pWndPopupOwner = this;
 
 	while (pWndPopupOwner->GetStyle() & WS_CHILD)
		pWndPopupOwner = pWndPopupOwner->GetParent();
 
 	pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x+20, point.y,
 		pWndPopupOwner);
 }


void CStructureTree::OnRclick(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here

	SendMessage(WM_CONTEXTMENU, (WPARAM) m_hWnd, GetMessagePos());	
	*pResult = 0;
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -