📄 newlistbox.cpp
字号:
// NewListBox.cpp : implementation file
//
#include "stdafx.h"
#include "DBManager.h"
#include "NewListBox.h"
#include "resource.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CNewListBox
CNewListBox::CNewListBox()
{
}
CNewListBox::~CNewListBox()
{
}
BEGIN_MESSAGE_MAP(CNewListBox, CListBox)
ON_WM_CONTEXTMENU()
//{{AFX_MSG_MAP(CNewListBox)
ON_WM_RBUTTONDOWN()
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CNewListBox message handlers
void CNewListBox::OnContextMenu(CWnd*, CPoint point)
{
// CG: This block was added by the Pop-up Menu component { if (point.x == -1 && point.y == -1){ //keystroke invocation CRect rect;
GetClientRect(rect);
ClientToScreen(rect);
point = rect.TopLeft(); point.Offset(5, 5); } CMenu menu; VERIFY(menu.LoadMenu(CG_IDR_POPUP_NEW_LIST_BOX)); 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); }
}
void CNewListBox::OnRButtonDown(UINT nFlags, CPoint point)
{
CPoint ptCursor;
::GetCursorPos( &ptCursor );
CMenu menu;
VERIFY(menu.LoadMenu(CG_IDR_POPUP_NEW_LIST_BOX));
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, ptCursor.x , ptCursor.y ,
pWndPopupOwner);
CListBox::OnRButtonDown(nFlags, point);
}
void CNewListBox::OnLButtonDown(UINT nFlags, CPoint point)
{
CListBox::OnLButtonDown(nFlags, point);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -