⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bookmanagerview.cpp

📁 用VC编写的一个实验室图书管理信息系统。大家可以看一下。代码标准。
💻 CPP
字号:
// bookmanagerView.cpp : implementation of the CBookmanagerView class
//

#include "stdafx.h"
#include "bookmanager.h"

#include "bookmanagerSet.h"
#include "bookmanagerDoc.h"
#include "bookmanagerView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CBookmanagerView

IMPLEMENT_DYNCREATE(CBookmanagerView, CRecordView)

BEGIN_MESSAGE_MAP(CBookmanagerView, CRecordView)
	//{{AFX_MSG_MAP(CBookmanagerView)
	ON_BN_CLICKED(IDC_ADD, OnAdd)
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CBookmanagerView construction/destruction

CBookmanagerView::CBookmanagerView()
	: CRecordView(CBookmanagerView::IDD)
{
	//{{AFX_DATA_INIT(CBookmanagerView)
	m_pSet = NULL;
	//}}AFX_DATA_INIT
	// TODO: add construction code here

}

CBookmanagerView::~CBookmanagerView()
{
}

void CBookmanagerView::DoDataExchange(CDataExchange* pDX)
{
	CRecordView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CBookmanagerView)
	DDX_FieldText(pDX, IDC_EDIT_BOOKNAME, m_pSet->m_column5, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_LENDORNO, m_pSet->m_column6, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_ADDITION, m_pSet->m_column7, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_LENDBOOKNAME, m_pSet->m_column2, m_pSet);
	DDX_FieldText(pDX, IDC_LENDER, m_pSet->m_column3, m_pSet);
	//}}AFX_DATA_MAP
}

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

	return CRecordView::PreCreateWindow(cs);
}

void CBookmanagerView::OnInitialUpdate()
{
	m_pSet = &GetDocument()->m_bookmanagerSet;
	CRecordView::OnInitialUpdate();
	GetParentFrame()->RecalcLayout();
	ResizeParentToFit();

}

/////////////////////////////////////////////////////////////////////////////
// CBookmanagerView printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CBookmanagerView diagnostics

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

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

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

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


/////////////////////////////////////////////////////////////////////////////
// CBookmanagerView message handlers

void CBookmanagerView::OnAdd() 
{
  if(!m_pSet->IsOpen()) return;
  if(!m_pSet->CanAppend()) return;
  m_pSet->AddNew();
  UpdateData(TRUE);
  if(m_pSet->CanUpdate())m_pSet->Update();
   m_pSet->Requery();
   UpdateData(FALSE);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -