fonttab.cpp

来自「VC++6开发指南的源代码第7章-第11章」· C++ 代码 · 共 90 行

CPP
90
字号
// FontTab.cpp : implementation file
//

#include "stdafx.h"
#include "TabDlgDemo.h"
#include "FontTab.h"

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

/////////////////////////////////////////////////////////////////////////////
// CFontTab dialog


CFontTab::CFontTab(CWnd* pParent /*=NULL*/)
	: CDialog(CFontTab::IDD, pParent)
{
	//{{AFX_DATA_INIT(CFontTab)
	m_radio = 0;
	m_height = 0;
	//}}AFX_DATA_INIT
}


void CFontTab::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CFontTab)
	DDX_Radio(pDX, IDC_RADIO1, m_radio);
	DDX_Text(pDX, IDC_EDIT1, m_height);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CFontTab, CDialog)
	//{{AFX_MSG_MAP(CFontTab)
	ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
	ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
	ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
	ON_BN_CLICKED(IDC_RADIO4, OnRadio4)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFontTab message handlers

void CFontTab::OnRadio1() 
{
	// TODO: Add your control notification handler code here
	m_radio=0;
	GetDlgItem(IDC_EDIT1)->EnableWindow(false);//编辑框禁止输入
	
}

void CFontTab::OnRadio2() 
{
	// TODO: Add your control notification handler code here
	m_radio=1;
	GetDlgItem(IDC_EDIT1)->EnableWindow(false);//编辑框禁止输入
	
}

void CFontTab::OnRadio3() 
{
	// TODO: Add your control notification handler code here
	m_radio=2;
	GetDlgItem(IDC_EDIT1)->EnableWindow(false);//编辑框禁止输入
	
}

void CFontTab::OnRadio4() 
{
	// TODO: Add your control notification handler code here
	m_radio=3;
	GetDlgItem(IDC_EDIT1)->EnableWindow(true);//编辑框允许输入
	
}

BOOL CFontTab::OnInitDialog() 
{
	CDialog::OnInitDialog();
	// TODO: Add extra initialization here
	GetDlgItem(IDC_EDIT1)->EnableWindow(false);//编辑框禁止输入
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

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