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

    //Download by http://www.NewXing.com
// clientView.cpp : implementation of the CClientView class
//

#include "stdafx.h"
#include "client.h"

#include "clientDoc.h"
#include "clientView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CClientView

IMPLEMENT_DYNCREATE(CClientView, CCrystalEditView)

BEGIN_MESSAGE_MAP(CClientView, CCrystalEditView)
	//{{AFX_MSG_MAP(CClientView)
	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()

/////////////////////////////////////////////////////////////////////////////
// CClientView construction/destruction

CClientView::CClientView()
{
}

CClientView::~CClientView()
{
}

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

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

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

void CClientView::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);
}