Ribbon Application With MFC C++

7

description

Simple application using MFC C++

Transcript of Ribbon Application With MFC C++

Generated file after create the project

The Interface is using style of Microsoft Office 2007 theme.

Source Code for Interface// Office 2007 style CMainFrame::CMainFrame() { // TODO: add member initialization code here theApp.m_nAppLook = theApp.GetInt(_T("ApplicationLook"), ID_VIEW_APPLOOK_OFF_2007_BLUE); }

// Change to this for Windows 7 style CMainFrame::CMainFrame() { // TODO: add member initialization code here theApp.m_nAppLook = theApp.GetInt(_T("ApplicationLook"), ID_VIEW_APPLOOK_WINDOWS_7); }

Source Code for Handle the Menu Button

void CMainFrame::OnTabLook(UINT id) { theApp.m_nTabLook = id; } theApp.WriteInt(_T("TabLook"), theApp.m_nTabLook);

void CMainFrame::OnUpdateTabLook(CCmdUI* pCmdUI) { pCmdUI->SetRadio(theApp.m_nTabLook == pCmdUI->m_nID); }

Source Code for Change the Tab Themevoid CMainFrame::OnTabLook(UINT id) { theApp.m_nTabLook = id; CMDITabInfo mdiTabParams; mdiTabParams.m_bActiveTabCloseButton = TRUE; // set to FALSE to place close button at right of tab area mdiTabParams.m_bTabIcons = FALSE; // set to TRUE to enable document icons on MDI taba mdiTabParams.m_bAutoColor = TRUE; // set to FALSE to disable auto-coloring of MDI tabs mdiTabParams.m_bDocumentMenu = TRUE; // enable the document menu at the right edge of the tab area switch (theApp.m_nTabLook) { case ID_TAB_THEME_3D: mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D; break; case ID_TAB_THEME_3D_ONENOTE: mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; break;

case ID_TAB_THEME_3D_ROUNDED: mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ROUNDED; break;case ID_TAB_THEME_3D_VISUAL_STUDIO: mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_VS2005; break;