英语出题及判分系统View.cpp
上传用户:z_mail1980
上传日期:2007-06-01
资源大小:647k
文件大小:4k
- // 英语出题及判分系统View.cpp : implementation of the CMyView class
- //
- #include "stdafx.h"
- #include "英语出题及判分系统.h"
- #include "英语出题及判分系统Set.h"
- #include "英语出题及判分系统Doc.h"
- #include "英语出题及判分系统View.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CMyView
- IMPLEMENT_DYNCREATE(CMyView, CRecordView)
- BEGIN_MESSAGE_MAP(CMyView, CRecordView)
- //{{AFX_MSG_MAP(CMyView)
- ON_BN_CLICKED(IDC_BUTTONNEXT, OnButtonnext)
- ON_BN_CLICKED(IDC_RADIOA, OnRadioa)
- ON_BN_CLICKED(IDC_RADIOB, OnRadiob)
- ON_BN_CLICKED(IDC_RADIOC, OnRadioc)
- ON_BN_CLICKED(IDC_RADIOD, OnRadiod)
- //}}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()
- /////////////////////////////////////////////////////////////////////////////
- // CMyView construction/destruction
- CMyView::CMyView()
- : CRecordView(CMyView::IDD)
- {
- //{{AFX_DATA_INIT(CMyView)
- m_pSet = NULL;
- //}}AFX_DATA_INIT
- // TODO: add construction code here
- m_count=0;
- }
- CMyView::~CMyView()
- {
- }
- void CMyView::DoDataExchange(CDataExchange* pDX)
- {
- CRecordView::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CMyView)
- DDX_FieldText(pDX, IDC_Topic, m_pSet->m_Topic, m_pSet);
- DDX_FieldText(pDX, IDC_STATICA, m_pSet->m_Answer1, m_pSet);
- DDX_FieldText(pDX, IDC_STATICB, m_pSet->m_Answer2, m_pSet);
- DDX_FieldText(pDX, IDC_STATICC, m_pSet->m_Answer3, m_pSet);
- DDX_FieldText(pDX, IDC_STATICD, m_pSet->m_Answer4, m_pSet);
- DDX_Text(pDX, IDC_STATICCOUNT, m_count);
- //}}AFX_DATA_MAP
- }
- BOOL CMyView::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
- return CRecordView::PreCreateWindow(cs);
- }
- void CMyView::OnInitialUpdate()
- {
- m_pSet = &GetDocument()->m_mySet;
- CRecordView::OnInitialUpdate();
- GetParentFrame()->RecalcLayout();
- ResizeParentToFit();
- }
- /////////////////////////////////////////////////////////////////////////////
- // CMyView printing
- BOOL CMyView::OnPreparePrinting(CPrintInfo* pInfo)
- {
- // default preparation
- return DoPreparePrinting(pInfo);
- }
- void CMyView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add extra initialization before printing
- }
- void CMyView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add cleanup after printing
- }
- /////////////////////////////////////////////////////////////////////////////
- // CMyView diagnostics
- #ifdef _DEBUG
- void CMyView::AssertValid() const
- {
- CRecordView::AssertValid();
- }
- void CMyView::Dump(CDumpContext& dc) const
- {
- CRecordView::Dump(dc);
- }
- CMyDoc* CMyView::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMyDoc)));
- return (CMyDoc*)m_pDocument;
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CMyView database support
- CRecordset* CMyView::OnGetRecordset()
- {
- return m_pSet;
- }
- /////////////////////////////////////////////////////////////////////////////
- // CMyView message handlers
- void CMyView::OnButtonnext()
- {
- // TODO: Add your control notification handler code here
- m_pSet->MoveNext();
- if(m_pSet->IsEOF()){
- MessageBox("记录已经在最后一条!");
- m_pSet->MovePrev();
- UpdateData(FALSE);
- return;
- }
- UpdateData(FALSE);
- }
- void CMyView::OnRadioa()
- {
- // TODO: Add your control notification handler code here
- if(m_pSet->m_FinAnswer=="A")
- {
- MessageBox("答对了!");
- ++m_count;
- UpdateData(FALSE);
- }
- else
- MessageBox("答错了!");
- }
- void CMyView::OnRadiob()
- {
- // TODO: Add your control notification handler code here
- if(m_pSet->m_FinAnswer=="B")
- {
- MessageBox("答对了!");
- ++m_count;
- UpdateData(FALSE);
- }
- else
- MessageBox("答错了!");
-
- }
- void CMyView::OnRadioc()
- {
- // TODO: Add your control notification handler code here
- if(m_pSet->m_FinAnswer=="C")
- {
- MessageBox("答对了!");
- ++m_count;
- UpdateData(FALSE);
- }
-
- else
- MessageBox("答错了!");
-
- }
- void CMyView::OnRadiod()
- {
- // TODO: Add your control notification handler code here
- if(m_pSet->m_FinAnswer=="D")
- {
- MessageBox("答对了!");
- ++m_count;
- UpdateData(FALSE);
- }
- else
- MessageBox("答错了!");
-
- }