【VC开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。网学会员整理了VC开源代码-CDraw_4View.cpp的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
// CDraw_4View.cpp : implementation of the CCDraw_4View class
//
#include "stdafx.h"
#include "CDraw_4.h"
#include "CDraw_4Doc.h"
#include "CDraw_4View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCDraw_4View
IMPLEMENT_DYNCREATE(CCDraw_4View, CView)
BEGIN_MESSAGE_MAP(CCDraw_4View, CView)
//{{AFX_MSG_MAP(CCDraw_4View)
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
//}}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()
/////////////////////////////////////////////////////////////////////////////
// CCDraw_4View construction/destruction
CCDraw_4View::CCDraw_4View()
{
// TODO: add construction code here
}
CCDraw_4View::~CCDraw_4View()
{
}
BOOL CCDraw_4View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CCDraw_4View drawing
void CCDraw_4View::OnDraw(CDC* pDC)
{
CCDraw_4Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CCDraw_4View printing
BOOL CCDraw_4View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CCDraw_4View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CCDraw_4View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CCDraw_4View diagnostics
#ifdef _DEBUG
void CCDraw_4View::AssertValid() const
{
CView::AssertValid();
}
void CCDraw_4View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CCDraw_4Doc* CCDraw_4View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCDraw_4Doc)));
return (CCDraw_4Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CCDraw_4View message handlers
void CCDraw_4View::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_point=point;
CView::OnLButtonDown(nFlags, point);
}
void CCDraw_4View::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CWindowDC dc(GetParent());
dc.MoveTo(m_point); //移动当前坐标
dc.LineTo(point); //划线
CView::OnLButtonUp(nFlags, point);
}
上一篇:
CDraw_4Doc.cpp
下一篇:
让我掉下眼泪的