📄 filetree.cpp
字号:
// FileTree.cpp : implementation file
//
#include "stdafx.h"
#include "miniSQL.h"
#include "FileTree.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFileTree
CFileTree::CFileTree()
{
}
CFileTree::~CFileTree()
{
}
BEGIN_MESSAGE_MAP(CFileTree, CTreeCtrl)
//{{AFX_MSG_MAP(CFileTree)
ON_WM_RBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFileTree message handlers
void CFileTree::SetMenuID(UINT nID1, UINT nID2)
{
m_menuID1 = nID1;
m_menuID2 = nID2;
}
UINT CFileTree::GetMenuID(int num)
{
if( num == 1 )
return m_menuID1;
if( num == 2 )
return m_menuID2;
return 0;
}
void CFileTree::OnRButtonDown(UINT nFlags, CPoint point)
{
CTreeCtrl::OnRButtonUp(nFlags, point);
HTREEITEM hItem = HitTest(point, &nFlags);
CTreeCtrl::Select( hItem, TVGN_CARET );
CRect Rect;
GetItemRect(hItem, Rect, TRUE);
if( point.x>=Rect.left && point.x<=Rect.right )
{
GetClientRect(Rect);
ClientToScreen(Rect);
point.Offset(Rect.TopLeft());
CMenu menu;
if( !GetParentItem( hItem ) )
//VERIFY(menu.LoadMenu(m_menuID1));
return ;
else if( !GetParentItem( GetParentItem( hItem ) ) )
VERIFY(menu.LoadMenu(m_menuID2));
else return;
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, point.y,
pWndPopupOwner);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -