ex010205view.cpp
来自「深入浅出Visual C++入门进阶与应用实例 随书光盘 作者 何志丹」· C++ 代码 · 共 138 行
CPP
138 行
// Ex010205View.cpp : implementation of the CEx010205View class
//
#include "stdafx.h"
#include "Ex010205.h"
#include "Ex010205Doc.h"
#include "Ex010205View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEx010205View
IMPLEMENT_DYNCREATE(CEx010205View, CFormView)
BEGIN_MESSAGE_MAP(CEx010205View, CFormView)
//{{AFX_MSG_MAP(CEx010205View)
ON_BN_CLICKED(IDC_FIND, OnFind)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CFormView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CFormView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CFormView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEx010205View construction/destruction
CEx010205View::CEx010205View()
: CFormView(CEx010205View::IDD)
{
//{{AFX_DATA_INIT(CEx010205View)
m_iStuNo = 0;
//}}AFX_DATA_INIT
// TODO: add construction code here
}
CEx010205View::~CEx010205View()
{
}
void CEx010205View::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CEx010205View)
DDX_Text(pDX, IDC_STUNO, m_iStuNo);
//}}AFX_DATA_MAP
}
BOOL CEx010205View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CFormView::PreCreateWindow(cs);
}
void CEx010205View::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
}
/////////////////////////////////////////////////////////////////////////////
// CEx010205View printing
BOOL CEx010205View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CEx010205View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CEx010205View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
void CEx010205View::OnPrint(CDC* pDC, CPrintInfo* /*pInfo*/)
{
// TODO: add customized printing code here
}
/////////////////////////////////////////////////////////////////////////////
// CEx010205View diagnostics
#ifdef _DEBUG
void CEx010205View::AssertValid() const
{
CFormView::AssertValid();
}
void CEx010205View::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
CEx010205Doc* CEx010205View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEx010205Doc)));
return (CEx010205Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CEx010205View message handlers
void CEx010205View::OnFind()
{
CEx010205Doc* pDoc = GetDocument();
if(NULL == pDoc )
{
ASSERT(false);
return ;
}
UpdateData();
if(!pDoc->SetCurStu(m_iStuNo))
{
AfxMessageBox("没有找到此学生");
return ;
}
pDoc->UpdateAllViews(NULL);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?