www.gusucode.com > VC++将对话框做为MDI子窗口的示例程序-源码程序 > VC++将对话框做为MDI子窗口的示例程序-源码程序/code/TSMLView.cpp

    // TSMLView.cpp : implementation of the CTSMLView class
// Download by http://www.NewXing.com

#include "stdafx.h"
#include "TSML.h"

#include "TSMLSet.h"
#include "TSMLDoc.h"
#include "TSMLView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CTSMLView

IMPLEMENT_DYNCREATE(CTSMLView, CRecordView)

BEGIN_MESSAGE_MAP(CTSMLView, CRecordView)
	//{{AFX_MSG_MAP(CTSMLView)
		// 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, CRecordView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CRecordView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CRecordView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTSMLView construction/destruction

CTSMLView::CTSMLView()
	: CRecordView(CTSMLView::IDD)
{
	//{{AFX_DATA_INIT(CTSMLView)
		// NOTE: the ClassWizard will add member initialization here
	m_pSet = NULL;
	//}}AFX_DATA_INIT
	// TODO: add construction code here

}

CTSMLView::~CTSMLView()
{
}

void CTSMLView::DoDataExchange(CDataExchange* pDX)
{
	CRecordView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CTSMLView)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}

BOOL CTSMLView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CRecordView::PreCreateWindow(cs);
}

void CTSMLView::OnInitialUpdate()
{
	m_pSet = &GetDocument()->m_tSMLSet;
	CRecordView::OnInitialUpdate();
	ResizeParentToFit();

}

/////////////////////////////////////////////////////////////////////////////
// CTSMLView printing

BOOL CTSMLView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CTSMLView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CTSMLView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CTSMLView diagnostics

#ifdef _DEBUG
void CTSMLView::AssertValid() const
{
	CRecordView::AssertValid();
}

void CTSMLView::Dump(CDumpContext& dc) const
{
	CRecordView::Dump(dc);
}

CTSMLDoc* CTSMLView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTSMLDoc)));
	return (CTSMLDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CTSMLView database support
CRecordset* CTSMLView::OnGetRecordset()
{
	return m_pSet;
}


/////////////////////////////////////////////////////////////////////////////
// CTSMLView message handlers