承接专栏《MFC工控项目实例之九选择下拉菜单主界面文本框显示菜单名》
参考前期我的博客文章《MFC3d立体按钮制作》
这里只给出相关代码
1、在SysTest.h文件中添加代码
#include "ShadeButtonST.h"
#include "BtnST.h"
class CSysTest : public CDialog
{
// Construction
public:
CSysTest(CWnd* pParent = NULL); // standard constructor
CShadeButtonST m_SysTest,m_BoardTest,m_SensorTSet,m_Return;
...
}
2、在SEAL_PRESSUREDlg.cpp文件中添加代码
void CSysTest::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSysTest)
// NOTE: the ClassWizard will add DDX and DDV calls here
DDX_Control(pDX, IDC_BUTTON_SysTest, m_SysTest);
DDX_Control(pDX, IDC_BUTTON_BoardTest, m_BoardTest);
DDX_Control(pDX, IDC_BUTTON_SensorTSet, m_SensorTSet);
DDX_Control(pDX, IDC_BUTTON_Return, m_Return);
//}}AFX_DATA_MAP
}
BOOL CSysTest::OnInitDialog()
{
CDialog::OnInitDialog();
m_SysTest.SetShade(CShadeButtonST::SHS_HARDBUMP);
m_BoardTest.SetShade(CShadeButtonST::SHS_HARDBUMP);
m_SensorTSet.SetShade(CShadeButtonST::SHS_HARDBUMP);
m_Return.SetShade(CShadeButtonST::SHS_HARDBUMP);
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
3、在SEAL_PRESSUREDlg.cpp文件中添加代码
#include "SysTest.h"
void CSEAL_PRESSUREDlg::OnSysTest()
{
// TODO: Add your control notification handler code here
CSysTest dlg;
dlg.DoModal();
}
运行程序