void CMSOffice2007DemoView::OnFontsize() { CMFCRibbonBar* pRibbon = ((CMainFrame*) GetTopLevelFrame())->GetRibbonBar(); ASSERT_VALID(pRibbon); CMFCRibbonComboBox* pSizeCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, pRibbon->FindByID(ID_FONT_FONTSIZE)); if (pSizeCombo == NULL) { return; } int nSize = GetTwipSize(pSizeCombo->GetEditText()); if (nSize == -2 || (nSize >= 0 && nSize < 20) || nSize > 32760) { // Restore current size: pSizeCombo->SetEditText (TwipsToPointString (GetCharFormatSelection ().yHeight)); MessageBox (_T("The number must be between 1 and 1638.")); return; } if (nSize > 0) { CCharFormat cf; cf.dwMask = CFM_SIZE; cf.yHeight = nSize; SetCharFormat(cf); } }
void CMainFrame::onFontSize() { CMFCRibbonComboBox* pFormatSelCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, m_wndRibbonBar.FindByID(WM_CHART_FORMAT_SEL_COMBO)); if (pFormatSelCombo == NULL) return; int iFormatElement=pFormatSelCombo->GetCurSel(); CMFCRibbonComboBox* pFonSize = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, m_wndRibbonBar.FindByID(WM_CHART_FORMAT_FONT_SIZE)); if (pFonSize == NULL) return; chartControl.setFormat(iFormatElement,CChartControl::Format_FontSize,pFonSize->GetEditText()); // }