void Cv11View::OnColor() { CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> arr; ((CMainFrame*)AfxGetMainWnd())->m_wndRibbonBar.GetElementsByID(ID_COLOR, arr); CMFCRibbonColorButton* pGallery = (CMFCRibbonColorButton*)arr.GetAt(0); color = pGallery->GetColor(); color1 = color; Invalidate(); }
void Cv11View::OnColor() { CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> arr; ((CMainFrame*)AfxGetMainWnd())->m_wndRibbonBar.GetElementsByID(ID_COLOR, arr); CMFCRibbonColorButton* pGalery = (CMFCRibbonColorButton*)arr.GetAt(0); color = pGalery->GetColor(); color_t = color; Invalidate(); // TODO: Add your command handler code here }
COLORREF CRibbonAppDoc::GetColor(void) { CMFCRibbonBar* pRibbon = ((CMDIFrameWndEx*) AfxGetMainWnd())->GetRibbonBar(); ASSERT_VALID(pRibbon); CMFCRibbonColorButton* pColor = DYNAMIC_DOWNCAST( CMFCRibbonColorButton, pRibbon->FindByID(ID_FONT_COLOR)); // Get the selected color return pColor->GetColor(); }
void CMainFrame::setOutlineColor() { CMFCRibbonComboBox* pFormatSelCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, m_wndRibbonBar.FindByID(WM_CHART_FORMAT_SEL_COMBO)); if (pFormatSelCombo == NULL) return; int iFormatElement=pFormatSelCombo->GetCurSel(); CMFCRibbonColorButton* pOutlineColorBtn = DYNAMIC_DOWNCAST(CMFCRibbonColorButton, m_wndRibbonBar.FindByID(WM_CHART_FORMAT_OUTLINE_COLOR)); if (pOutlineColorBtn == NULL) return; CString str; str.Format(_T("%.3d%.3d%.3d"),GetRValue(pOutlineColorBtn->GetColor()), GetGValue(pOutlineColorBtn->GetColor()), GetBValue(pOutlineColorBtn->GetColor())); AfxMessageBox(str); chartControl.setFormat(iFormatElement,CChartControl::Format_OutlineColor,str); }
void CMSOffice2007DemoView::OnFontColor() { CMFCRibbonBar* pRibbon = ((CMainFrame*) GetTopLevelFrame())->GetRibbonBar(); ASSERT_VALID(pRibbon); CMFCRibbonColorButton* pFontColorBtn = DYNAMIC_DOWNCAST(CMFCRibbonColorButton, pRibbon->FindByID(ID_FONT_COLOR)); if (pFontColorBtn != NULL) { COLORREF color = pFontColorBtn->GetColor(); CRichEditView::OnColorPick(color == -1 ? ::GetSysColor(COLOR_WINDOWTEXT) : color); } }
COLORREF CMainFrame::GetColorFromColorButton(int nButtonID) { CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> arButtons; m_wndRibbonBar.GetElementsByID(nButtonID, arButtons); if (arButtons.GetSize() == 0) { return(COLORREF) -1; } CMFCRibbonColorButton* pColorButton = (CMFCRibbonColorButton*)arButtons.GetAt(0); COLORREF clr = pColorButton->GetColor(); if (clr == (COLORREF)-1) { clr = pColorButton->GetAutomaticColor(); } return clr; }