LRESULT Cv11View::OnHighlightRibbonListItem(WPARAM wp, LPARAM lp) { int index = (int)wp; CMFCRibbonBaseElement* pElem = (CMFCRibbonBaseElement*)lp; UINT id = pElem->GetID(); // button id (ID_SHAPE, ID_COLOR) if (index == -1) { shape = saveshape; color = savecolor; } else { if (ID_SHAPE == id) { shape = index; } if (ID_COLOR == id) { CMFCRibbonColorButton * button = (CMFCRibbonColorButton*)pElem; color = button->GetHighlightedColor(); } } Invalidate(); return 0; }
afx_msg LRESULT Cv11View::OnAfxWmOnHighlightRibbonListItem(WPARAM wParam, LPARAM lParam) { int index = int(wParam); CMFCRibbonBaseElement* pElem = (CMFCRibbonBaseElement*)lParam; UINT id = pElem->GetID(); switch (id){ case ID_SHAPE: shape = index; Invalidate(); break; case ID_COLOR: CMFCRibbonColorButton *button = (CMFCRibbonColorButton*)pElem; color = button->GetHighlightedColor(); Invalidate(); break; } if (index == -1) { shape = shape_t; color = color_t; Invalidate(); } return 0; }
LRESULT Cv11View::OnHighlightRibbonListItem(WPARAM wp, LPARAM lp) { int index = (int)wp; CMFCRibbonBaseElement* pElem = (CMFCRibbonBaseElement*)lp; UINT id = pElem->GetID(); // button id (ID_SHAPE, ID_COLOR) if (index >= 0){ if (id == ID_SHAPE){ shape = index; Invalidate(); } if (id == ID_COLOR){ CMFCRibbonColorButton* pColor = (CMFCRibbonColorButton*)pElem; color = pColor->GetHighlightedColor(); Invalidate(); } } else { shape = shape1; color = color1; Invalidate(); } return 0; }