deptdialog.cpp

来自「vc++6.0数据库编程大全一书得各个章节得源码,比较详细.可以仔细参照学习!」· C++ 代码 · 共 57 行

CPP
57
字号
// DeptDialog.cpp : Implementation of CDeptDialog
#include "stdafx.h"
#include "DeptDialog.h"

/////////////////////////////////////////////////////////////////////////////
// CDeptDialog
void CDeptDialog::UpdateData(BOOL bSaveChangesToSet)
{
	if (bSaveChangesToSet) {
		//Read From Screen
		GetDlgItemText(IDC_CODE,
			(char *) m_pSet[0][m_nCurrentRow].m_DepartmentCode, 5);
		GetDlgItemText(IDC_NAME,
			(char *) m_pSet[0][m_nCurrentRow].m_DepartmentName, 51);
	}
	else {
		//Write to Screen
		SetDlgItemText(IDC_CODE,
			(char *) m_pSet[0][m_nCurrentRow].m_DepartmentCode);
		SetDlgItemText(IDC_NAME,
			(char *) m_pSet[0][m_nCurrentRow].m_DepartmentName);
	}
}
void CDeptDialog::OnMove(CPosition position)
{
	UpdateData(TRUE);	//Read from screen
	DisplayStatus("");
	switch (position) {
	case (FIRST) :
		m_nCurrentRow = 0;
		break;
	case (NEXT) :
		m_nCurrentRow++;
		if (m_nCurrentRow > m_nMaxRows) {	//EOF
			m_nCurrentRow = m_nMaxRows;
			DisplayStatus("Last record reached.");
		}
		break;
	case (LAST) :
		m_nCurrentRow = m_nMaxRows;
		break;
	case (PREV) :
		m_nCurrentRow--;
		if (m_nCurrentRow < 0) {	//BOF
			m_nCurrentRow = 0;
			DisplayStatus("First record reached.");
		}
		break;
	}
	UpdateData(FALSE);	//Update Screen
}
void CDeptDialog::DisplayStatus(char *strMessage)
{
	SetDlgItemText(IDC_STATUS, strMessage);
}

⌨️ 快捷键说明

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