承接专栏《MFC工控项目实例之八选择下拉菜单添加打钩图标》
1、在主界面添加一个组合框和一个静态文本框。
2、在SEAL_PRESSUREDlg.cpp文件中添加代码
BOOL CSEAL_PRESSUREDlg::OnInitDialog()
{
CDialog::OnInitDialog();
...
GetDlgItem(IDC_STATIC_TYPNAME)->SetFont(&m_sFont);
...
}
void CSEAL_PRESSUREDlg::OnTypeChange(UINT nID)
{
theApp.m_nProductSel = nID - ID_DEF_PRODUCT+1;
CWinApp* pApp = AfxGetApp();
pApp->WriteProfileInt("参数","nProductSel1",theApp.m_nProductSel);
CString str = theApp.m_allPara[theApp.m_nProductSel].m_strTypeName;
SetDlgItemText(IDC_STATIC_TYPNAME,str);
}
运行程序