www.gusucode.com > VC++编写的SQL服务端和客户端源码程序 > VC++编写的SQL服务端和客户端源码程序\code\Server\miniSQLView.cpp

    //Download by http://www.NewXing.com
// miniSQLView.cpp : implementation of the CMiniSQLView class
//

#include "stdafx.h"
#include "miniSQL.h"

#include "miniSQLDoc.h"
#include "miniSQLView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMiniSQLView

IMPLEMENT_DYNCREATE(CMiniSQLView, CCrystalEditView)

BEGIN_MESSAGE_MAP(CMiniSQLView, CCrystalEditView)
	//{{AFX_MSG_MAP(CMiniSQLView)
	ON_WM_RBUTTONUP()
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CCrystalEditView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CCrystalEditView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CCrystalEditView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMiniSQLView construction/destruction

CMiniSQLView::CMiniSQLView()
{
}

CMiniSQLView::~CMiniSQLView()
{
}

/////////////////////////////////////////////////////////////////////////////
// CMiniSQLView message handlers
CCrystalTextBuffer* CMiniSQLView::LocateTextBuffer()
{
	return &((CMiniSQLDoc* )GetDocument())->m_TextBuffer;
}

void CMiniSQLView::OnInitialUpdate()
{
	CCrystalEditView::OnInitialUpdate();

	SetFont(((CMiniSQLDoc *)GetDocument())->m_lf);
}

void CMiniSQLView::OnRButtonUp(UINT nFlags, CPoint point) 
{
	ClientToScreen( &point );

	CMenu menu;
	VERIFY( menu.LoadMenu( IDR_CRYSTAL ) );
	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);

	CCrystalEditView::OnRButtonUp(nFlags, point);
}