www.pudn.com > ImgSeg.rar > ImgSegView.cpp
// ImgSegView.cpp : implementation of the CImgSegView class
//
#include "stdafx.h"
#include "ImgSeg.h"
#include "ImgSegDoc.h"
#include "ImgSegView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CImgSegView
IMPLEMENT_DYNCREATE(CImgSegView, CScrollView)
BEGIN_MESSAGE_MAP(CImgSegView, CScrollView)
//{{AFX_MSG_MAP(CImgSegView)
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()
/////////////////////////////////////////////////////////////////////////////
// CImgSegView construction/destruction
CImgSegView::CImgSegView()
{
// TODO: add construction code here
}
CImgSegView::~CImgSegView()
{
}
BOOL CImgSegView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CScrollView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CImgSegView drawing
void CImgSegView::OnDraw(CDC* pDC)
{
CImgSegDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
pDoc->ShowBitmap(pDC);
}
void CImgSegView::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
CSize sizeTotal;
CImgSegDoc* pDoc=GetDocument();
// TODO: calculate the total size of this view
sizeTotal.cx=pDoc->m_lWidth;
sizeTotal.cy=pDoc->m_lHeight;
SetScrollSizes(MM_TEXT,sizeTotal);
}
/////////////////////////////////////////////////////////////////////////////
// CImgSegView printing
BOOL CImgSegView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CImgSegView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CImgSegView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CImgSegView diagnostics
#ifdef _DEBUG
void CImgSegView::AssertValid() const
{
CScrollView::AssertValid();
}
void CImgSegView::Dump(CDumpContext& dc) const
{
CScrollView::Dump(dc);
}
CImgSegDoc* CImgSegView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CImgSegDoc)));
return (CImgSegDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CImgSegView message handlers