www.gusucode.com > VC++编写的SQL服务端和客户端源码程序 > VC++编写的SQL服务端和客户端源码程序\code\Server\RichEdit.cpp
//Download by http://www.NewXing.com // RichEdit.cpp : implementation file // #include "stdafx.h" #include "miniSQL.h" #include "RichEdit.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CRichEdit CRichEdit::CRichEdit() { } CRichEdit::~CRichEdit() { } BEGIN_MESSAGE_MAP(CRichEdit, CRichEditCtrl) //{{AFX_MSG_MAP(CRichEdit) ON_WM_RBUTTONDOWN() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CRichEdit message handlers void CRichEdit::SetMenuID( UINT nID ) { m_menuID = nID; } UINT CRichEdit::GetMenuID() { return m_menuID; } void CRichEdit::OnRButtonDown(UINT nFlags, CPoint point) { CRichEditCtrl::OnRButtonDown(nFlags, point); CRect Rect; GetClientRect(Rect); ClientToScreen(Rect); point.Offset( Rect.TopLeft() ); CMenu menu; VERIFY( menu.LoadMenu( m_menuID ) ); CMenu* pPop = menu.GetSubMenu( 0 ); ASSERT( pPop ); CWnd* pWndPopupOwner = this; while (pWndPopupOwner->GetStyle() & WS_CHILD) pWndPopupOwner = pWndPopupOwner->GetParent(); pPop->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, pWndPopupOwner); }