代码:
void CSubCalibrationxxxDlg::OnBnClickedRadioLine()
{
// TODO: 在此添加控件通知处理程序代码
if ( m_fgManuaClicked )
{
m_fgManuaClicked = FALSE;
return;
}
if ( m_fgDoneCorrect )
{
int iType = AfxMessageBox(_T("调整结果,是否要保存?" ),MB_YESNOCANCEL|MB_ICONQUESTION);
if ( iType == IDYES ) //Yes
{
OnBnClickedBtnSaveToDisk();
}
else if ( iType == IDNO ) //No
{
AfxMessageBox(_T("切换为“直线调整”模式,将清空上次的调整数据!"));
}
else if ( iType == IDCANCEL ) //Cancel
{
vSimulateRadioButtonClicked();
return;
}
}
......
}
void CSubxxxDlg::OnBnClickedRadioCurve()
{
// TODO: 在此添加控件通知处理程序代码
if ( m_fgManuaClicked )
{
m_fgManuaClicked = FALSE;
return;
}
if ( m_fgDoneCorrect )
{
int iType = AfxMessageBox(_T("调整结果,是否要保存?" ),MB_YESNOCANCEL|MB_ICONQUESTION);
if ( iType == IDYES ) //Yes
{
OnBnClickedBtnSaveToDisk();
}
else if ( iType == IDNO ) //No
{
AfxMessageBox(_T("切换为“曲线调整”模式,将清空上次的调整数据!"));
}
else if ( iType == IDCANCEL ) //Cancel
{
vSimulateRadioButtonClicked();
return;
}
}
......
}
void CSubxxxDlg::OnBnClickedRadioMixed()
{
// TODO: 在此添加控件通知处理程序代码
if ( m_fgManuaClicked )
{
m_fgManuaClicked = FALSE;
return;
}
if ( m_fgDoneCorrect )
{
int iType = AfxMessageBox(_T("调整结果,是否要保存?" ),MB_YESNOCANCEL|MB_ICONQUESTION);
if ( iType == IDYES ) //Yes
{
OnBnClickedBtnSaveToDisk();
}
else if ( iType == IDNO ) //No
{
AfxMessageBox(_T("切换为“混合调整”模式,将清空上次的调整数据!"));
}
else if ( iType == IDCANCEL ) //Cancel
{
vSimulateRadioButtonClicked();
return;
}
}
......
}
void CSubxxxDlg::vSimulateRadioButtonClicked()
{
m_fgManuaClicked = TRUE; //用来标志是否是模拟Radio Button的点击动作
UINT uiID = 0;
switch ( m_iRadioIndex )
{
case 0:
uiID = IDC_RADIO_LINE;
break;
case 1:
uiID = IDC_RADIO_CURVE;
break;
case 2:
uiID = IDC_RADIO_MIXED;
break;
default:
return;
break;
}
GetDlgItem(uiID)->PostMessage( WM_LBUTTONDOWN );
GetDlgItem(uiID)->PostMessage( WM_LBUTTONUP);
}