www.pudn.com > DialogBar调用切分窗口.rar > lestView.cpp
// lestView.cpp : implementation of the CLeftView class
//
#include "stdafx.h"
#include "task.h"
#include "taskDoc.h"
#include "leftView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CLeftView
IMPLEMENT_DYNCREATE(CLeftView, CScrollView)
BEGIN_MESSAGE_MAP(CLeftView, CScrollView)
//{{AFX_MSG_MAP(CLeftView)
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CScrollView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CScrollView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CScrollView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CLeftView construction/destruction
CLeftView::CLeftView()
{
// TODO: add construction code here
}
CLeftView::~CLeftView()
{
}
BOOL CLeftView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CScrollView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CLeftView drawing
void CLeftView::OnDraw(CDC* pDC)
{
CTaskDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
void CLeftView::OnInitialUpdate()
{
SetScrollSizes(MM_LOENGLISH,CSize(400,400));
CScrollView::OnInitialUpdate();
CSize sizeTotal;
// TODO: calculate the total size of this view
sizeTotal.cx = sizeTotal.cy = 100;
SetScrollSizes(MM_TEXT, sizeTotal);
}
/////////////////////////////////////////////////////////////////////////////
// CLeftView printing
BOOL CLeftView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CLeftView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CLeftView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CLeftView diagnostics
#ifdef _DEBUG
void CLeftView::AssertValid() const
{
CScrollView::AssertValid();
}
void CLeftView::Dump(CDumpContext& dc) const
{
CScrollView::Dump(dc);
}
CTaskDoc* CLeftView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTaskDoc)));
return (CTaskDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CLeftView message handlers
void CLeftView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CClientDC dc(this);
OnPrepareDC(&dc);
dc.DPtoLP(&point);
SetCapture();
m_ptPrev=point;
CScrollView::OnLButtonDown(nFlags, point);
}
void CLeftView::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if (GetCapture()!=this)
return;
CClientDC dc(this);
OnPrepareDC(&dc);
dc.DPtoLP(&point);
dc.MoveTo(m_ptPrev);
dc.LineTo(point);
Cmyline *p1=new Cmyline(m_ptPrev,point);
this->m_ptList.AddTail(p1);
ReleaseCapture();
CScrollView::OnLButtonUp(nFlags, point);
}
void CLeftView::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if (GetCapture()!=this)
return;
CClientDC dc(this);
OnPrepareDC(&dc);
dc.DPtoLP(&point);
dc.MoveTo(m_ptPrev);
dc.LineTo(point);
Cmyline *p1=new Cmyline(m_ptPrev,point);
this->m_ptList.AddTail(p1);
m_ptPrev=point;
CScrollView::OnMouseMove(nFlags, point);
}