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

📄 memoinfodlg.cpp

📁 < Visual C+++SQL Server数据库开发与实例>>一书中的实例核心源程序提供了几个案例的编程源代码。
💻 CPP
字号:
// MemoInfoDlg.cpp : implementation file
//

#include "stdafx.h"
#include "MemoDBS.h"
#include "MemoInfoDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMemoInfoDlg dialog


CMemoInfoDlg::CMemoInfoDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CMemoInfoDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CMemoInfoDlg)
	m_strMember = _T("");
	m_strMemoType = _T("");
	m_oleDate = COleDateTime::GetCurrentTime();
	m_oleTime = COleDateTime::GetCurrentTime();
	m_isEvent = FALSE;
	m_strMemoInfo = _T("");
	m_strCost = _T("");
	//}}AFX_DATA_INIT
}


void CMemoInfoDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CMemoInfoDlg)
	DDX_Control(pDX, IDC_COMBO_TYPE, m_comboType);
	DDX_Control(pDX, IDC_COMBO_MEMBER, m_comboMember);
	DDX_CBString(pDX, IDC_COMBO_MEMBER, m_strMember);
	DDX_CBString(pDX, IDC_COMBO_TYPE, m_strMemoType);
	DDX_DateTimeCtrl(pDX, IDC_DT_DATE, m_oleDate);
	DDX_DateTimeCtrl(pDX, IDC_DT_TIME, m_oleTime);
	DDX_Check(pDX, IDC_CHECK_EVENT, m_isEvent);
	DDX_Text(pDX, IDC_EDIT_MEMO, m_strMemoInfo);
	DDX_Text(pDX, IDC_EDIT_COST, m_strCost);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CMemoInfoDlg, CDialog)
	//{{AFX_MSG_MAP(CMemoInfoDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMemoInfoDlg message handlers

BOOL CMemoInfoDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	//在成员组合框控件中添加成员姓名数据.
	for(int i = 0 ; i < m_strMemberArray.GetSize(); i++)
		m_comboMember.AddString(m_strMemberArray.GetAt(i));
	
	//如果是修改记录,则组合框的文本值为要修改的成员姓名.
	if(!m_strMember.IsEmpty())
		m_comboMember.SetWindowText(m_strMember);
    //如果是添加记录,则组合框的文本值为组合框中成员列表中的第一个.
	else
		m_comboMember.SetCurSel(0);
	//向类型组合框控件中添加类型记录.
	for(i = 0 ; i < m_strTypeArray.GetSize(); i++)
		m_comboType.AddString(m_strTypeArray.GetAt(i));
	//如果是修改记录,则组合框的文本值为要修改的备忘录类型.
    if(!m_strMemoType.IsEmpty())
		m_comboType.SetWindowText(m_strMemoType);	
	//如果是添加记录,则组合框的文本值为组合框中成员列表中的第一个.
	else
		m_comboType.SetCurSel(0);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CMemoInfoDlg::OnOK() 
{
	// TODO: Add extra validation here
	if(!UpdateData())
		return;
	//备忘录类型不能够为空
	if(m_strMemoType.IsEmpty()){
		AfxMessageBox("备忘录类型为空,请重新选择备忘录类型");
		return;
	}
	//成员的姓名不能够为空
	if(m_strMember.IsEmpty()){
		AfxMessageBox("成员姓名为空,请重新选择成员姓名");
		return;
	}	
	CDialog::OnOK();
}

⌨️ 快捷键说明

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