dlgadd.cpp

来自「这个是由《Visual C++ 6.0实例教程》源代码教材里的一个关于简单处理文」· C++ 代码 · 共 86 行

CPP
86
字号
// DlgAdd.cpp : implementation file
//

#include "stdafx.h"
#include "Array.h"
#include "DlgAdd.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDlgAdd dialog


CDlgAdd::CDlgAdd(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgAdd::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgAdd)
	m_nRadio = -1;
	m_strValue = _T("");
	m_nIndex = 0;
	//}}AFX_DATA_INIT
}


void CDlgAdd::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgAdd)
	DDX_Radio(pDX, IDC_RADIO_SET, m_nRadio);
	DDX_Text(pDX, IDC_EDIT_VALUE, m_strValue);
	DDX_Text(pDX, IDC_EDIT_INDEX, m_nIndex);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgAdd, CDialog)
	//{{AFX_MSG_MAP(CDlgAdd)
	ON_BN_CLICKED(IDC_RADIO_SET, OnRadioSet)
	ON_BN_CLICKED(IDC_RADIO_ADD, OnRadioAdd)
	ON_BN_CLICKED(IDC_RADIO_INSERT, OnRadioInsert)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgAdd message handlers

BOOL CDlgAdd::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
    ((CButton*)GetDlgItem(IDC_RADIO_SET))->SetCheck(1);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CDlgAdd::OnRadioSet() 
{
	// TODO: Add your control notification handler code here
	GetDlgItem(IDC_EDIT_INDEX)->EnableWindow(true);	
}

void CDlgAdd::OnRadioAdd() 
{
	// TODO: Add your control notification handler code here
	GetDlgItem(IDC_EDIT_INDEX)->EnableWindow(false);	
}

void CDlgAdd::OnRadioInsert() 
{
	// TODO: Add your control notification handler code here
	GetDlgItem(IDC_EDIT_INDEX)->EnableWindow(true);	
}

void CDlgAdd::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData(true);
	CDialog::OnOK();
}

⌨️ 快捷键说明

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