【VC开源代码栏目提醒】:网学会员在VC开源代码频道为大家收集整理了Ex05_8View.cpp提供大家参考,希望对大家有所帮助!
// Ex05_8View.cpp : implementation of the CEx05_8View class
//
#include "stdafx.h"
#include "Ex05_8.h"
#include "Ex05_8Doc.h"
#include "Ex05_8View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEx05_8View
IMPLEMENT_DYNCREATE(CEx05_8View, CView)
BEGIN_MESSAGE_MAP(CEx05_8View, CView)
//{{AFX_MSG_MAP(CEx05_8View)
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEx05_8View construction/destruction
CEx05_8View::CEx05_8View()
{
// TODO: add construction code here
}
CEx05_8View::~CEx05_8View()
{
}
BOOL CEx05_8View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CEx05_8View drawing
void CEx05_8View::OnDraw(CDC* pDC)
{
CEx05_8Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CEx05_8View printing
BOOL CEx05_8View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CEx05_8View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CEx05_8View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CEx05_8View diagnostics
#ifdef _DEBUG
void CEx05_8View::AssertValid() const
{
CView::AssertValid();
}
void CEx05_8View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CEx05_8Doc* CEx05_8View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEx05_8Doc)));
return (CEx05_8Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CEx05_8View message handlers
void CEx05_8View::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CStatusBar* pStatus=(CStatusBar*) AfxGetApp()->m_pMainWnd->GetDescendantWindow(ID_VIEW_STATUS_BAR);
if(pStatus)
{
char mouseposition[40];
sprintf(mouseposition,"(%d,%d)",point.x,point.y);
//在状态条的第二个窗格中输出当前鼠标的位置
pStatus->SetPaneText(1,mouseposition,TRUE);
pStatus->SetPaneInfo( 1, ID_INDICATOR_MOUSE,SBPS_POPOUT, 80);
}
CView::OnMouseMove(nFlags, point);
}