ex45View.cpp
资源名称:VC6.0.rar [点击查看]
上传用户:qdhmjx
上传日期:2022-07-11
资源大小:2226k
文件大小:2k
源码类别:
书籍源码
开发平台:
Visual C++
- // ex45View.cpp : implementation of the CEx45View class
- //
- #include "stdafx.h"
- #include "ex45.h"
- #include "ex45Doc.h"
- #include "ex45View.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CEx45View
- IMPLEMENT_DYNCREATE(CEx45View, CView)
- BEGIN_MESSAGE_MAP(CEx45View, CView)
- //{{AFX_MSG_MAP(CEx45View)
- ON_WM_LBUTTONDOWN()
- //}}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()
- /////////////////////////////////////////////////////////////////////////////
- // CEx45View construction/destruction
- CEx45View::CEx45View()
- {
- // TODO: add construction code here
- }
- CEx45View::~CEx45View()
- {
- }
- BOOL CEx45View::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
- return CView::PreCreateWindow(cs);
- }
- /////////////////////////////////////////////////////////////////////////////
- // CEx45View drawing
- void CEx45View::OnDraw(CDC* pDC)
- {
- CEx45Doc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
- // TODO: add draw code for native data here
- }
- /////////////////////////////////////////////////////////////////////////////
- // CEx45View printing
- BOOL CEx45View::OnPreparePrinting(CPrintInfo* pInfo)
- {
- // default preparation
- return DoPreparePrinting(pInfo);
- }
- void CEx45View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add extra initialization before printing
- }
- void CEx45View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add cleanup after printing
- }
- /////////////////////////////////////////////////////////////////////////////
- // CEx45View diagnostics
- #ifdef _DEBUG
- void CEx45View::AssertValid() const
- {
- CView::AssertValid();
- }
- void CEx45View::Dump(CDumpContext& dc) const
- {
- CView::Dump(dc);
- }
- CEx45Doc* CEx45View::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEx45Doc)));
- return (CEx45Doc*)m_pDocument;
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CEx45View message handlers
- void CEx45View::OnLButtonDown(UINT nFlags, CPoint point)
- {
- CDC *pDC=GetDC(); //CDC类,第5章讲述
- pDC->TextOut(point.x,point.y,"hello",5);//在鼠标左键单击的位置输出文本
- CView::OnLButtonDown(nFlags, point);
- }