ex54View.cpp
资源名称:VC6.0.rar [点击查看]
上传用户:qdhmjx
上传日期:2022-07-11
资源大小:2226k
文件大小:3k
源码类别:
书籍源码
开发平台:
Visual C++
- // ex54View.cpp : implementation of the CEx54View class
- //
- #include "stdafx.h"
- #include "ex54.h"
- #include "ex54Doc.h"
- #include "ex54View.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CEx54View
- IMPLEMENT_DYNCREATE(CEx54View, CView)
- BEGIN_MESSAGE_MAP(CEx54View, CView)
- //{{AFX_MSG_MAP(CEx54View)
- 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()
- /////////////////////////////////////////////////////////////////////////////
- // CEx54View construction/destruction
- CEx54View::CEx54View()
- {
- // TODO: add construction code here
- }
- CEx54View::~CEx54View()
- {
- }
- BOOL CEx54View::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
- return CView::PreCreateWindow(cs);
- }
- /////////////////////////////////////////////////////////////////////////////
- // CEx54View drawing
- void CEx54View::OnDraw(CDC* pDC)
- {
- CEx54Doc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
- // TODO: add draw code for native data here
- }
- /////////////////////////////////////////////////////////////////////////////
- // CEx54View printing
- BOOL CEx54View::OnPreparePrinting(CPrintInfo* pInfo)
- {
- // default preparation
- return DoPreparePrinting(pInfo);
- }
- void CEx54View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add extra initialization before printing
- }
- void CEx54View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add cleanup after printing
- }
- /////////////////////////////////////////////////////////////////////////////
- // CEx54View diagnostics
- #ifdef _DEBUG
- void CEx54View::AssertValid() const
- {
- CView::AssertValid();
- }
- void CEx54View::Dump(CDumpContext& dc) const
- {
- CView::Dump(dc);
- }
- CEx54Doc* CEx54View::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEx54Doc)));
- return (CEx54Doc*)m_pDocument;
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CEx54View message handlers
- void CEx54View::OnLButtonDown(UINT nFlags, CPoint point)
- {
- // TODO: Add your message handler code here and/or call default
- CDC *pDC=GetDC();
- CBrush newbrush(HS_CROSS,RGB(0,255,0));//创建一个新画刷
- CBrush *poldbrush;
- poldbrush=pDC->SelectObject(&newbrush);//将新画刷选入设备环境
- CRect rect;
- GetClientRect(&rect);
- pDC->Ellipse(&rect);//用新画刷画椭圆
- pDC->SelectObject(poldbrush);//恢复旧画刷
- CView::OnLButtonDown(nFlags, point);
- }