|
显示当前选定的组合框项目。 1. 更新 MainFrm.cpp 中的函数,以便在从组合框中的下拉列表中选择项目时显示一个消息框:
C++
void CMainFrame::OnComboMessage()
{
CMFCRibbonComboBox* pFontComboBox = DYNAMIC_DOWNCAST(
CMFCRibbonComboBox, m_wndRibbonBar.FindByID(ID_COMBO_BOX));
// Get the selected index
int nCurSel =pFontComboBox->GetCurSel();
if (nCurSel >= 0)
{
CString item=pFontComboBox->GetItem(nCurSel);
CString sMessage = _T("");
sMessage.Format(_T("Current Selected Item is \"%s\"."),item);
MessageBox(sMessage, _T("Combo Box Item"), MB_OK);
}
else
{
MessageBox(_T("Please select one item from droplist of Combo Box."), _T("Combo Box Item"), MB_OK);
}
} (责任编辑:admin) |





骆驼户外男 真皮磨砂日常休闲鞋 低帮 2011秋冬新款 专柜正品特价