ex53View.cpp
资源名称:VC6.0.rar [点击查看]
上传用户:qdhmjx
上传日期:2022-07-11
资源大小:2226k
文件大小:3k
源码类别:
书籍源码
开发平台:
Visual C++
- // ex53View.cpp : implementation of the CEx53View class
- //
- #include "stdafx.h"
- #include "ex53.h"
- #include "ex53Doc.h"
- #include "ex53View.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CEx53View
- IMPLEMENT_DYNCREATE(CEx53View, CView)
- BEGIN_MESSAGE_MAP(CEx53View, CView)
- //{{AFX_MSG_MAP(CEx53View)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- // DO NOT EDIT what you see in these blocks of generated code!
- //}}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()
- /////////////////////////////////////////////////////////////////////////////
- // CEx53View construction/destruction
- CEx53View::CEx53View()
- {
- // TODO: add construction code here
- }
- CEx53View::~CEx53View()
- {
- }
- BOOL CEx53View::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
- return CView::PreCreateWindow(cs);
- }
- /////////////////////////////////////////////////////////////////////////////
- // CEx53View drawing
- void CEx53View::OnDraw(CDC* pDC)
- {
- CEx53Doc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
- // TODO: add draw code for native data here
- CPen NewPen;
- NewPen.CreatePen(PS_SOLID,3,RGB(255,0,0));//创建新画笔
- CPen* pOldPen;
- pOldPen=pDC->SelectObject(&NewPen); //将新画笔选入设备环境
- pDC->MoveTo(100,100);
- pDC->LineTo(200,200); //用新画笔画一条直线
- pDC->SelectObject(pOldPen); // 恢复设备环境中原来的画笔
- NewPen.DeleteObject();
- }
- /////////////////////////////////////////////////////////////////////////////
- // CEx53View printing
- BOOL CEx53View::OnPreparePrinting(CPrintInfo* pInfo)
- {
- // default preparation
- return DoPreparePrinting(pInfo);
- }
- void CEx53View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add extra initialization before printing
- }
- void CEx53View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add cleanup after printing
- }
- /////////////////////////////////////////////////////////////////////////////
- // CEx53View diagnostics
- #ifdef _DEBUG
- void CEx53View::AssertValid() const
- {
- CView::AssertValid();
- }
- void CEx53View::Dump(CDumpContext& dc) const
- {
- CView::Dump(dc);
- }
- CEx53Doc* CEx53View::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEx53Doc)));
- return (CEx53Doc*)m_pDocument;
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CEx53View message handlers