testview.cpp
来自「VIUSAL C++实现的考试管理系统,涉及到试卷生成,成绩记录等功能.」· C++ 代码 · 共 99 行
CPP
99 行
// TestView.cpp : implementation file
//
#include "stdafx.h"
#include "TestApp.h"
#include "TestView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTestView
IMPLEMENT_DYNCREATE(CTestView, CRecordView)
CTestView::CTestView()
: CRecordView(CTestView::IDD)
{
//{{AFX_DATA_INIT(CTestView)
m_pSet = NULL;
//}}AFX_DATA_INIT
}
CTestView::~CTestView()
{
if (m_pSet)
delete m_pSet;
}
void CTestView::DoDataExchange(CDataExchange* pDX)
{
CRecordView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTestView)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CTestView, CRecordView)
//{{AFX_MSG_MAP(CTestView)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTestView diagnostics
#ifdef _DEBUG
void CTestView::AssertValid() const
{
CRecordView::AssertValid();
}
void CTestView::Dump(CDumpContext& dc) const
{
CRecordView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CTestView message handlers
CRecordset* CTestView::OnGetRecordset()
{
if (m_pSet != NULL)
return m_pSet;
m_pSet = new CPapersSet(NULL);
m_pSet->Open();
return m_pSet;
}
CPapersSet* CTestView::GetRecordset()
{
CPapersSet* pData = (CPapersSet*) OnGetRecordset();
ASSERT(pData == NULL || pData->IsKindOf(RUNTIME_CLASS(CPapersSet)));
return pData;
}
void CTestView::OnInitialUpdate()
{
BeginWaitCursor();
GetRecordset();
CRecordView::OnInitialUpdate();
if (m_pSet->IsOpen())
{
CString strTitle = m_pSet->m_pDatabase->GetDatabaseName();
CString strTable = m_pSet->GetTableName();
if (!strTable.IsEmpty())
strTitle += _T(":") + strTable;
GetDocument()->SetTitle(strTitle);
}
EndWaitCursor();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?