int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1) return -1; BOOL bNameValid; CMDITabInfo mdiTabParams; mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; // other styles available... 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 EnableMDITabbedGroups(TRUE, mdiTabParams); m_wndRibbonBar.Create(this); m_wndRibbonBar.LoadFromResource(IDR_RIBBON); if (!m_wndStatusBar.Create(this)) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } CString strTitlePane1; CString strTitlePane2; bNameValid = strTitlePane1.LoadString(IDS_STATUS_PANE1); ASSERT(bNameValid); bNameValid = strTitlePane2.LoadString(IDS_STATUS_PANE2); ASSERT(bNameValid); m_wndStatusBar.AddElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE1, strTitlePane1, TRUE), strTitlePane1); m_wndStatusBar.AddExtendedElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE2, strTitlePane2, TRUE), strTitlePane2); // enable Visual Studio 2005 style docking window behavior CDockingManager::SetDockingMode(DT_SMART); // enable Visual Studio 2005 style docking window auto-hide behavior EnableAutoHidePanes(CBRS_ALIGN_ANY); // create docking windows if (!CreateDockingWindows()) { TRACE0("Failed to create docking windows\n"); return -1; } m_wndOutput.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndOutput); m_wndProperties.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndProperties); // Enable enhanced windows management dialog EnableWindowsDialog(ID_WINDOW_MANAGER, ID_WINDOW_MANAGER, TRUE); // Switch the order of document name and application name on the window title bar. This // improves the usability of the taskbar because the document name is visible with the thumbnail. ModifyStyle(0, FWS_PREFIXTITLE); return 0; }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1) return -1; // set the visual manager and style based on persisted value OnApplicationLook(theApp.m_nAppLook); CMDITabInfo mdiTabParams; mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; // other styles available... 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 = FALSE; // 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 mdiTabParams.m_bTabCustomTooltips = TRUE; EnableMDITabbedGroups(TRUE, mdiTabParams); if (theApp.IsRibbon()) { if (!CreateRibbon()) return -1; } else { if (!CreateToolbars()) return -1; } if (!m_wndStatusBar.Create(this)) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)); SetTitle(lpCreateStruct->lpszName); m_oleDropTarget.Register(this); // Enable enhanced windows management dialog EnableWindowsDialog(ID_WINDOW_MANAGER, IDS_WINDOWS_MANAGER, TRUE); if (!theApp.IsRibbon()) { if (!SetupToolbars()) return -1; } else { PopulateRenderingSetList(); } return 0; }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1) return -1; GToolEBM::StartupEBM(); // 모든 사용자 인터페이스 요소를 그리는 데 사용하는 비주얼 관리자를 설정합니다. CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2007)); CMDITabInfo mdiTabParams; mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; // 사용할 수 있는 다른 스타일... mdiTabParams.m_bActiveTabCloseButton = TRUE; // FALSE로 설정하여 탭 영역 오른쪽에 닫기 단추를 배치합니다. mdiTabParams.m_bTabIcons = FALSE; // TRUE로 설정하여 MDI 탭의 문서 아이콘을 활성화합니다. mdiTabParams.m_bAutoColor = TRUE; // FALSE로 설정하여 MDI 탭의 자동 색 지정을 비활성화합니다. mdiTabParams.m_bDocumentMenu = TRUE; // 탭 영역의 오른쪽 가장자리에 문서 메뉴를 활성화합니다. EnableMDITabbedGroups(TRUE, mdiTabParams); m_wndRibbonBar.Create(this); m_wndRibbonBar.LoadFromResource(IDR_RIBBON); // Visual Studio 2005 스타일 도킹 창 동작을 활성화합니다. CDockingManager::SetDockingMode(DT_SMART); // Visual Studio 2005 스타일 도킹 창 자동 숨김 동작을 활성화합니다. EnableAutoHidePanes(CBRS_ALIGN_ANY); // 탐색 창이 왼쪽에 만들어지므로 일시적으로 왼쪽에 도킹을 비활성화합니다. EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM | CBRS_ALIGN_RIGHT); // "Outlook" 탐색 모음을 만들고 설치합니다. if (!CreateOutlookBar(m_wndNavigationBar, ID_VIEW_NAVIGATION, m_wndTree, m_wndCalendar, 250)) { TRACE0("탐색 창을 만들지 못했습니다.\n"); return -1; // 만들지 못했습니다. } // Outlook 표시줄이 만들어지고 왼쪽에 도킹할 수 있도록 허용해야 합니다. EnableDocking(CBRS_ALIGN_LEFT); EnableAutoHidePanes(CBRS_ALIGN_RIGHT); // 향상된 창 관리 대화 상자를 활성화합니다. EnableWindowsDialog(ID_WINDOW_MANAGER, ID_WINDOW_MANAGER, TRUE); // 창 제목 표시줄에서 문서 이름 및 응용 프로그램 이름의 순서를 전환합니다. // 문서 이름이 축소판 그림과 함께 표시되므로 작업 표시줄의 기능성이 개선됩니다. ModifyStyle(0, FWS_PREFIXTITLE); return 0; }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1) return -1; BOOL bNameValid; // 基于持久值设置视觉管理器和样式 OnApplicationLook(theApp.m_nAppLook); CMDITabInfo mdiTabParams; mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; // 其他可用样式... mdiTabParams.m_bActiveTabCloseButton = TRUE; // 设置为 FALSE 会将关闭按钮放置在选项卡区域的右侧 mdiTabParams.m_bTabIcons = FALSE; // 设置为 TRUE 将在 MDI 选项卡上启用文档图标 mdiTabParams.m_bAutoColor = TRUE; // 设置为 FALSE 将禁用 MDI 选项卡的自动着色 mdiTabParams.m_bDocumentMenu = TRUE; // 在选项卡区域的右边缘启用文档菜单 EnableMDITabbedGroups(TRUE, mdiTabParams); if (!m_wndMenuBar.Create(this)) { TRACE0("未能创建菜单栏\n"); return -1; // 未能创建 } m_wndMenuBar.SetPaneStyle(m_wndMenuBar.GetPaneStyle() | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY); // 防止菜单栏在激活时获得焦点 CMFCPopupMenu::SetForceMenuFocus(FALSE); if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(theApp.m_bHiColorIcons ? IDR_MAINFRAME_256 : IDR_MAINFRAME)) { TRACE0("未能创建工具栏\n"); return -1; // 未能创建 } CString strToolBarName; bNameValid = strToolBarName.LoadString(IDS_TOOLBAR_STANDARD); ASSERT(bNameValid); m_wndToolBar.SetWindowText(strToolBarName); CString strCustomize; bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE); ASSERT(bNameValid); m_wndToolBar.EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize); // 允许用户定义的工具栏操作: InitUserToolbars(NULL, uiFirstUserToolBarId, uiLastUserToolBarId); if (!m_wndStatusBar.Create(this)) { TRACE0("未能创建状态栏\n"); return -1; // 未能创建 } m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)); // TODO: 如果您不希望工具栏和菜单栏可停靠,请删除这五行 m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY); m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndMenuBar); DockPane(&m_wndToolBar); // 启用 Visual Studio 2005 样式停靠窗口行为 CDockingManager::SetDockingMode(DT_SMART); // 启用 Visual Studio 2005 样式停靠窗口自动隐藏行为 EnableAutoHidePanes(CBRS_ALIGN_ANY); // 加载菜单项图像(不在任何标准工具栏上): CMFCToolBar::AddToolBarForImageCollection(IDR_MENU_IMAGES, theApp.m_bHiColorIcons ? IDB_MENU_IMAGES_24 : 0); // 创建停靠窗口 if (!CreateDockingWindows()) { TRACE0("未能创建停靠窗口\n"); return -1; } m_wndFileView.EnableDocking(CBRS_ALIGN_ANY); m_wndClassView.EnableDocking(CBRS_ALIGN_ANY); m_wndKitView.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndFileView); CDockablePane* pTabbedBar = NULL; m_wndClassView.AttachToTabWnd(&m_wndFileView, DM_SHOW, TRUE, &pTabbedBar); CDockablePane* pTabbedBarForKitView = NULL; m_wndKitView.AttachToTabWnd(&m_wndFileView, DM_SHOW, TRUE, &pTabbedBarForKitView); m_wndOutput.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndOutput); m_wndProperties.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndProperties); // 启用增强的窗口管理对话框 EnableWindowsDialog(ID_WINDOW_MANAGER, ID_WINDOW_MANAGER, TRUE); // 启用工具栏和停靠窗口菜单替换 EnablePaneMenu(TRUE, ID_VIEW_CUSTOMIZE, strCustomize, ID_VIEW_TOOLBAR); // 启用快速(按住 Alt 拖动)工具栏自定义 CMFCToolBar::EnableQuickCustomization(); if (CMFCToolBar::GetUserImages() == NULL) { // 加载用户定义的工具栏图像 if (m_UserImages.Load(_T(".\\UserImages.bmp"))) { CMFCToolBar::SetUserImages(&m_UserImages); } } // 启用菜单个性化(最近使用的命令) // TODO: 定义您自己的基本命令,确保每个下拉菜单至少有一个基本命令。 CList<UINT, UINT> lstBasicCommands; //lstBasicCommands.AddTail(ID_FILE_NEW); lstBasicCommands.AddTail(ID_FILE_OPEN); lstBasicCommands.AddTail(ID_FILE_NEW_CONFIG); lstBasicCommands.AddTail(ID_FILE_NEW_SKIN); lstBasicCommands.AddTail(ID_FILE_SAVE); lstBasicCommands.AddTail(ID_FILE_PRINT); lstBasicCommands.AddTail(ID_APP_EXIT); lstBasicCommands.AddTail(ID_EDIT_CUT); lstBasicCommands.AddTail(ID_EDIT_PASTE); lstBasicCommands.AddTail(ID_EDIT_UNDO); lstBasicCommands.AddTail(ID_APP_ABOUT); lstBasicCommands.AddTail(ID_VIEW_STATUS_BAR); lstBasicCommands.AddTail(ID_VIEW_TOOLBAR); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2003); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_VS_2005); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_BLUE); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_SILVER); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_BLACK); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_AQUA); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_WINDOWS_7); lstBasicCommands.AddTail(ID_SORTING_SORTALPHABETIC); lstBasicCommands.AddTail(ID_SORTING_SORTBYTYPE); lstBasicCommands.AddTail(ID_SORTING_SORTBYACCESS); lstBasicCommands.AddTail(ID_SORTING_GROUPBYTYPE); CMFCToolBar::SetBasicCommands(lstBasicCommands); // 将文档名和应用程序名称在窗口标题栏上的顺序进行交换。这 // 将改进任务栏的可用性,因为显示的文档名带有缩略图。 ModifyStyle(0, FWS_PREFIXTITLE); return 0; }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1) return -1; BOOL bNameValid; // set the visual manager and style based on persisted value OnApplicationLook(theApp.m_nAppLook); CMDITabInfo mdiTabParams; mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; // other styles available... 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 EnableMDITabbedGroups(TRUE, mdiTabParams); if (!m_wndMenuBar.Create(this)) { TRACE0("Failed to create menubar\n"); return -1; // fail to create } m_wndMenuBar.SetPaneStyle(m_wndMenuBar.GetPaneStyle() | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY); // prevent the menu bar from taking the focus on activation CMFCPopupMenu::SetForceMenuFocus(FALSE); if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(theApp.m_bHiColorIcons ? IDR_MAINFRAME_256 : IDR_MAINFRAME)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } CString strToolBarName; bNameValid = strToolBarName.LoadString(IDS_TOOLBAR_STANDARD); ASSERT(bNameValid); m_wndToolBar.SetWindowText(strToolBarName); CString strCustomize; bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE); ASSERT(bNameValid); m_wndToolBar.EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize); // Allow user-defined toolbars operations: InitUserToolbars(NULL, uiFirstUserToolBarId, uiLastUserToolBarId); if (!m_wndStatusBar.Create(this)) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)); // TODO: Delete these five lines if you don't want the toolbar and menubar to be dockable m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY); m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndMenuBar); DockPane(&m_wndToolBar); // enable Visual Studio 2005 style docking window behavior CDockingManager::SetDockingMode(DT_SMART); // enable Visual Studio 2005 style docking window auto-hide behavior EnableAutoHidePanes(CBRS_ALIGN_ANY); // Load menu item image (not placed on any standard toolbars): CMFCToolBar::AddToolBarForImageCollection(IDR_MENU_IMAGES, theApp.m_bHiColorIcons ? IDB_MENU_IMAGES_24 : 0); // create docking windows if (!CreateDockingWindows()) { TRACE0("Failed to create docking windows\n"); return -1; } m_wndFileView.EnableDocking(CBRS_ALIGN_ANY); m_wndClassView.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndFileView); CDockablePane* pTabbedBar = NULL; m_wndClassView.AttachToTabWnd(&m_wndFileView, DM_SHOW, TRUE, &pTabbedBar); m_wndOutput.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndOutput); m_wndProperties.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndProperties); // Enable enhanced windows management dialog EnableWindowsDialog(ID_WINDOW_MANAGER, ID_WINDOW_MANAGER, TRUE); // Enable toolbar and docking window menu replacement EnablePaneMenu(TRUE, ID_VIEW_CUSTOMIZE, strCustomize, ID_VIEW_TOOLBAR); // enable quick (Alt+drag) toolbar customization CMFCToolBar::EnableQuickCustomization(); if (CMFCToolBar::GetUserImages() == NULL) { // load user-defined toolbar images if (m_UserImages.Load(_T(".\\UserImages.bmp"))) { CMFCToolBar::SetUserImages(&m_UserImages); } } // enable menu personalization (most-recently used commands) // TODO: define your own basic commands, ensuring that each pulldown menu has at least one basic command. CList<UINT, UINT> lstBasicCommands; lstBasicCommands.AddTail(ID_FILE_NEW); lstBasicCommands.AddTail(ID_FILE_OPEN); lstBasicCommands.AddTail(ID_FILE_SAVE); lstBasicCommands.AddTail(ID_FILE_PRINT); lstBasicCommands.AddTail(ID_APP_EXIT); lstBasicCommands.AddTail(ID_EDIT_CUT); lstBasicCommands.AddTail(ID_EDIT_PASTE); lstBasicCommands.AddTail(ID_EDIT_UNDO); lstBasicCommands.AddTail(ID_APP_ABOUT); lstBasicCommands.AddTail(ID_VIEW_STATUS_BAR); lstBasicCommands.AddTail(ID_VIEW_TOOLBAR); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2003); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_VS_2005); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_BLUE); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_SILVER); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_BLACK); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_AQUA); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_WINDOWS_7); lstBasicCommands.AddTail(ID_SORTING_SORTALPHABETIC); lstBasicCommands.AddTail(ID_SORTING_SORTBYTYPE); lstBasicCommands.AddTail(ID_SORTING_SORTBYACCESS); lstBasicCommands.AddTail(ID_SORTING_GROUPBYTYPE); CMFCToolBar::SetBasicCommands(lstBasicCommands); // Switch the order of document name and application name on the window title bar. This // improves the usability of the taskbar because the document name is visible with the thumbnail. ModifyStyle(0, FWS_PREFIXTITLE); return 0; }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1) return -1; // set the visual manager and style based on persisted value OnApplicationLook(theApp.m_nAppLook); CMDITabInfo mdiTabParams; mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D; // other styles available... 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 = FALSE; // 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 EnableMDITabbedGroups(TRUE, mdiTabParams); m_wndRibbonBar.Create(this); m_wndRibbonBar.LoadFromResource(IDR_RIBBON); // enable Visual Studio 2005 style docking window behavior CDockingManager::SetDockingMode(DT_IMMEDIATE); // enable Visual Studio 2005 style docking window auto-hide behavior EnableAutoHidePanes(CBRS_ALIGN_ANY); // create docking windows if (!CreateDockingWindows()) { TRACE0("Failed to create docking windows\n"); return -1; } // Enable enhanced windows management dialog EnableWindowsDialog(ID_WINDOW_MANAGER, ID_WINDOW_MANAGER, TRUE); // Switch the order of document name and application name on the window title bar. This // improves the usability of the taskbar because the document name is visible with the thumbnail. ModifyStyle(0, FWS_PREFIXTITLE); //Update Colors CMFCRibbonColorButton* pColor; pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CBACKGROUND); pColor->SetColor(crBackground); pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CSELECT); pColor->SetColor(crSelect); pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CHIDDEN); pColor->SetColor(crHidden); pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_COFFSET); pColor->SetColor(crOffset); pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CADDRESS); pColor->SetColor(crAddress); pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CTYPE); pColor->SetColor(crType); pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CNAME); pColor->SetColor(crName); pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CINDEX); pColor->SetColor(crIndex); pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CVALUE); pColor->SetColor(crValue); pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CCOMMENT); pColor->SetColor(crComment); pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CVTABLE); pColor->SetColor(crVTable); pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CFUNCTION); pColor->SetColor(crFunction); pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CTEXT); pColor->SetColor(crChar); pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CCUSTOM); pColor->SetColor(crCustom); pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CHEX); pColor->SetColor(crHex); //CreateConsole( ); // Why? SetTimer( 69, 5000, NULL ); return 0; }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1) return -1; BOOL bNameValid; CMDITabInfo mdiTabParams; mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; // other styles available... 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 EnableMDITabbedGroups(TRUE, mdiTabParams); m_wndRibbonBar.Create(this); m_wndRibbonBar.LoadFromResource(IDR_RIBBON); if (!m_wndStatusBar.Create(this)) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } CString strTitlePane1; CString strTitlePane2; bNameValid = strTitlePane1.LoadString(IDS_STATUS_PANE1); ASSERT(bNameValid); bNameValid = strTitlePane2.LoadString(IDS_STATUS_PANE2); ASSERT(bNameValid); m_wndStatusBar.AddElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE1, strTitlePane1, TRUE), strTitlePane1); m_wndStatusBar.AddExtendedElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE2, strTitlePane2, TRUE), strTitlePane2); // enable Visual Studio 2005 style docking window behavior CDockingManager::SetDockingMode(DT_SMART); // enable Visual Studio 2005 style docking window auto-hide behavior EnableAutoHidePanes(CBRS_ALIGN_ANY); // Navigation pane will be created at left, so temporary disable docking at the left side: EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM | CBRS_ALIGN_RIGHT); // Create and setup "Outlook" navigation bar: if (!CreateOutlookBar(m_wndNavigationBar, ID_VIEW_NAVIGATION, m_wndTree, m_wndCalendar, 250)) { TRACE0("Failed to create navigation pane\n"); return -1; // fail to create } // Create a caption bar: if (!CreateCaptionBar()) { TRACE0("Failed to create caption bar\n"); return -1; // fail to create } // Outlook bar is created and docking on the left side should be allowed. EnableDocking(CBRS_ALIGN_LEFT); EnableAutoHidePanes(CBRS_ALIGN_RIGHT); // Load menu item image (not placed on any standard toolbars): CMFCToolBar::AddToolBarForImageCollection(IDR_MENU_IMAGES, theApp.m_bHiColorIcons ? IDB_MENU_IMAGES_24 : 0); // create docking windows if (!CreateDockingWindows()) { TRACE0("Failed to create docking windows\n"); return -1; } m_wndFileView.EnableDocking(CBRS_ALIGN_ANY); m_wndClassView.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndFileView); CDockablePane* pTabbedBar = NULL; m_wndClassView.AttachToTabWnd(&m_wndFileView, DM_SHOW, TRUE, &pTabbedBar); m_wndProperties.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndProperties); // set the visual manager and style based on persisted value OnApplicationLook(theApp.m_nAppLook); // Enable enhanced windows management dialog EnableWindowsDialog(ID_WINDOW_MANAGER, ID_WINDOW_MANAGER, TRUE); // Switch the order of document name and application name on the window title bar. This // improves the usability of the taskbar because the document name is visible with the thumbnail. ModifyStyle(0, FWS_PREFIXTITLE); return 0; }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1) return -1; BOOL bNameValid; // 基于持久值设置视觉管理器和样式 OnApplicationLook(theApp.m_nAppLook); CMDITabInfo mdiTabParams; mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; // 其他可用样式... mdiTabParams.m_bActiveTabCloseButton = TRUE; // 设置为 FALSE 会将关闭按钮放置在选项卡区域的右侧 mdiTabParams.m_bTabIcons = FALSE; // 设置为 TRUE 将在 MDI 选项卡上启用文档图标 mdiTabParams.m_bAutoColor = TRUE; // 设置为 FALSE 将禁用 MDI 选项卡的自动着色 mdiTabParams.m_bDocumentMenu = TRUE; // 在选项卡区域的右边缘启用文档菜单 EnableMDITabbedGroups(TRUE, mdiTabParams); if (!m_wndMenuBar.Create(this)) { TRACE0("未能创建菜单栏\n"); return -1; // 未能创建 } m_wndMenuBar.SetPaneStyle(m_wndMenuBar.GetPaneStyle() | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY); // 防止菜单栏在激活时获得焦点 CMFCPopupMenu::SetForceMenuFocus(FALSE); if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) /*|| !m_wndToolBar.LoadToolBar(theApp.m_bHiColorIcons ? IDR_MAINFRAME_256 : IDR_MAINFRAME)*/) { TRACE0("未能创建工具栏\n"); return -1; // 未能创建 } else { CToolBarMaintianer::GetInstance().SetToolBar(&m_wndToolBar); CToolBarMaintianer::GetInstance().InitBasicItems(); /*m_ToolCmbTest.EnableWindow(true); m_ToolCmbTest.SetCenterVert(); m_ToolCmbTest.SetDropDownHeight(25); m_ToolCmbTest.SetFlatMode(); m_ToolCmbTest.AddItem(_T("1")); m_ToolCmbTest.AddItem(_T("3")); m_ToolCmbTest.AddItem(_T("2")); m_ToolCmbTest.SelectItem(0); m_wndToolBar.InsertButton(m_ToolCmbTest);*/ } CString strToolBarName; bNameValid = strToolBarName.LoadString(IDS_TOOLBAR_STANDARD); ASSERT(bNameValid); m_wndToolBar.SetWindowText(strToolBarName); CString strCustomize; bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE); ASSERT(bNameValid); m_wndToolBar.EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize); // 允许用户定义的工具栏操作: InitUserToolbars(NULL, uiFirstUserToolBarId, uiLastUserToolBarId); if (!m_wndStatusBar.Create(this)) { TRACE0("未能创建状态栏\n"); return -1; // 未能创建 } m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)); // TODO: 如果您不希望工具栏和菜单栏可停靠,请删除这五行 m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY); m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndMenuBar); DockPane(&m_wndToolBar); // 启用 Visual Studio 2005 样式停靠窗口行为 CDockingManager::SetDockingMode(DT_SMART); // 启用 Visual Studio 2005 样式停靠窗口自动隐藏行为 EnableAutoHidePanes(CBRS_ALIGN_ANY); // 加载菜单项图像(不在任何标准工具栏上): CMFCToolBar::AddToolBarForImageCollection(IDR_MENU_IMAGES, theApp.m_bHiColorIcons ? IDB_MENU_IMAGES_24 : 0); // 创建停靠窗口 if (!CreateDockingWindows()) { TRACE0("未能创建停靠窗口\n"); return -1; } m_wndFileView.EnableDocking(CBRS_ALIGN_ANY); m_wndClassView.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndFileView); CDockablePane* pTabbedBar = NULL; m_wndClassView.AttachToTabWnd(&m_wndFileView, DM_SHOW, TRUE, &pTabbedBar); m_wndSide.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndSide); m_wndProperties.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndProperties); // 启用增强的窗口管理对话框 EnableWindowsDialog(ID_WINDOW_MANAGER, IDS_WINDOWS_MANAGER, TRUE); // 启用工具栏和停靠窗口菜单替换 EnablePaneMenu(TRUE, ID_VIEW_CUSTOMIZE, strCustomize, ID_VIEW_TOOLBAR); // 启用快速(按住 Alt 拖动)工具栏自定义 CMFCToolBar::EnableQuickCustomization(); if (CMFCToolBar::GetUserImages() == NULL) { // 加载用户定义的工具栏图像 if (m_UserImages.Load(_T(".\\UserImages.bmp"))) { m_UserImages.SetImageSize(CSize(16, 16), FALSE); CMFCToolBar::SetUserImages(&m_UserImages); } } return 0; }
int CTinyCADMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1) return -1; BOOL bNameValid; // 基于持久值设置视觉管理器和样式 OnApplicationLook(theApp.m_nAppLook); CMDITabInfo mdiTabParams; mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; // 其他可用样式... mdiTabParams.m_bActiveTabCloseButton = TRUE; // 设置为 FALSE 会将关闭按钮放置在选项卡区域的右侧 mdiTabParams.m_bTabIcons = FALSE; // 设置为 TRUE 将在 MDI 选项卡上启用文档图标 mdiTabParams.m_bAutoColor = TRUE; // 设置为 FALSE 将禁用 MDI 选项卡的自动着色 mdiTabParams.m_bDocumentMenu = TRUE; // 在选项卡区域的右边缘启用文档菜单 EnableMDITabbedGroups(TRUE, mdiTabParams); m_wndRibbonBar.Create(this); InitializeRibbon(); if (!m_wndStatusBar.Create(this)) { TRACE0("未能创建状态栏\n"); return -1; // 未能创建 } CString strTitlePane1; CString strTitlePane2; bNameValid = strTitlePane1.LoadString(IDS_STATUS_PANE1); ASSERT(bNameValid); bNameValid = strTitlePane2.LoadString(IDS_STATUS_PANE2); ASSERT(bNameValid); m_wndStatusBar.AddElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE1, strTitlePane1, TRUE), strTitlePane1); m_wndStatusBar.AddExtendedElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE2, strTitlePane2, TRUE), strTitlePane2); // 启用 Visual Studio 2005 样式停靠窗口行为 CDockingManager::SetDockingMode(DT_SMART); // 启用 Visual Studio 2005 样式停靠窗口自动隐藏行为 EnableAutoHidePanes(CBRS_ALIGN_ANY); // 加载菜单项图像(不在任何标准工具栏上): CMFCToolBar::AddToolBarForImageCollection(IDR_MENU_IMAGES, theApp.m_bHiColorIcons ? IDB_MENU_IMAGES_24 : 0); // 创建停靠窗口 if (!CreateDockingWindows()) { TRACE0("未能创建停靠窗口\n"); return -1; } m_wndFileView.EnableDocking(CBRS_ALIGN_ANY); m_wndClassView.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndFileView); CDockablePane* pTabbedBar = NULL; m_wndClassView.AttachToTabWnd(&m_wndFileView, DM_SHOW, TRUE, &pTabbedBar); m_wndOutput.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndOutput); m_wndProperties.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndProperties); // 启用增强的窗口管理对话框 EnableWindowsDialog(ID_WINDOW_MANAGER, IDS_WINDOWS_MANAGER, TRUE); return 0; }
/// <summary>Creates child windows and sets up MFC GUI classes</summary> /// <param name="lpCreateStruct">The create data.</param> /// <returns></returns> int MainWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) { try { // Create base if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1) throw Win32Exception(HERE, L"Unable to CMDIFrameWndEx window"); // Setup Document Tabs EnableMDITabbedGroups(TRUE, DefaultTabStyle()); // prevent the menu bar from taking the focus on activation CMFCPopupMenu::SetForceMenuFocus(FALSE); // Load menu item image (not placed on any standard toolbars): CMFCToolBar::AddToolBarForImageCollection(IDT_MENU_IMAGES, IDT_MENU_IMAGES); CMFCToolBar::AddToolBarForImageCollection(IDT_FILE, IDT_FILE); CMFCToolBar::AddToolBarForImageCollection(IDT_EDIT, IDT_EDIT); CMFCToolBar::AddToolBarForImageCollection(IDT_GAMEDATA, IDT_GAMEDATA); CMFCToolBar::AddToolBarForImageCollection(IDT_VIEW, IDT_VIEW); CMFCToolBar::AddToolBarForImageCollection(IDR_EDITOR, IDR_EDITOR); CMFCToolBar::AddToolBarForImageCollection(IDR_PROJECTVIEW, IDR_PROJECTVIEW); CMFCToolBar::AddToolBarForImageCollection(IDR_BACKUP, IDR_BACKUP); CMFCToolBar::m_dblLargeImageRatio = 1.2; // enable quick (Alt+drag) toolbar customization CMFCToolBar::EnableQuickCustomization(); // load user-defined toolbar images /*if (!CMFCToolBar::GetUserImages() && m_UserImages.Load(IDB_USER_IMAGES)) CMFCToolBar::SetUserImages(&m_UserImages);*/ // enable Visual Studio 2008 style docking + AutoHide CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerVS2008)); CDockingManager::SetDockingMode(DT_SMART); // Create Toolbars CreateToolBars(); // Create Tool windows CreateToolWindows(); // Set document icons?? UpdateMDITabbedBarsIcons(); // Redraw? RedrawWindow(NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME | RDW_ERASE); // Enable windows management dialog EnableWindowsDialog(ID_WINDOW_MANAGER, ID_WINDOW_MANAGER, TRUE); // Enable 'customize' command in menu //EnablePaneMenu(TRUE, ID_VIEW_CUSTOMIZE, GuiString(IDS_TOOLBAR_CUSTOMIZE).c_str(), ID_VIEW_CUSTOMIZE); // Switch the order of document name and application name on the window title bar. This // improves the usability of the taskbar because the document name is visible with the thumbnail. ModifyStyle(0, FWS_PREFIXTITLE); // Defer-Invoke 'OnInitialUpdate' once created PostMessage(WM_INITIALUPDATE); // Feedback Console << Cons::Success << "Initialized main window" << ENDL; return 0; } catch (ExceptionBase& e) { theApp.ShowError(HERE, e); return -1; } }
void CMainFrame::OnAppLook(UINT id) { CBCGPDockManager::SetDockMode (BCGP_DT_SMART); m_nAppLook = id; CBCGPTabbedControlBar::m_StyleTabWnd = CBCGPTabWnd::STYLE_3D; CBCGPMDITabParams mdiTabParams; mdiTabParams.m_bTabIcons = TRUE; switch (m_nAppLook) { case ID_VIEW_APPLOOK_2000: // enable Office 2000 look: CBCGPVisualManager::SetDefaultManager (RUNTIME_CLASS (CBCGPVisualManager)); break; case ID_VIEW_APPLOOK_XP: // enable Office XP look: CBCGPVisualManager::SetDefaultManager (RUNTIME_CLASS (CBCGPVisualManagerXP)); break; case ID_VIEW_APPLOOK_WIN_XP: // enable Windows XP look (in other OS Office XP look will be used): CBCGPWinXPVisualManager::m_b3DTabsXPTheme = TRUE; CBCGPVisualManager::SetDefaultManager (RUNTIME_CLASS (CBCGPWinXPVisualManager)); break; case ID_VIEW_APPLOOK_2003: // enable Office 2003 look: CBCGPVisualManager::SetDefaultManager (RUNTIME_CLASS (CBCGPVisualManager2003)); mdiTabParams.m_style = CBCGPTabWnd::STYLE_3D_VS2005; mdiTabParams.m_bAutoColor = TRUE; CBCGPDockManager::SetDockMode (BCGP_DT_SMART); break; case ID_VIEW_APPLOOK_2007: case ID_VIEW_APPLOOK_2007_1: case ID_VIEW_APPLOOK_2007_2: case ID_VIEW_APPLOOK_2007_3: // enable Office 2007 look: CBCGPVisualManager::SetDefaultManager (RUNTIME_CLASS (CBCGPVisualManager2007)); mdiTabParams.m_style = CBCGPTabWnd::STYLE_3D_VS2005; mdiTabParams.m_bAutoColor = TRUE; CBCGPDockManager::SetDockMode (BCGP_DT_SMART); break; case ID_VIEW_APPLOOK_2010_1: case ID_VIEW_APPLOOK_2010_2: case ID_VIEW_APPLOOK_2010_3: // enable Office 2010 look: CBCGPVisualManager::SetDefaultManager (RUNTIME_CLASS (CBCGPVisualManager2010)); mdiTabParams.m_style = CBCGPTabWnd::STYLE_3D_VS2005; mdiTabParams.m_bAutoColor = TRUE; CBCGPDockManager::SetDockMode (BCGP_DT_SMART); break; case ID_VIEW_APPLOOK_WIN7: // enable Windows look: CBCGPVisualManager::SetDefaultManager (RUNTIME_CLASS (CBCGPVisualManagerScenic)); mdiTabParams.m_style = CBCGPTabWnd::STYLE_3D_VS2005; mdiTabParams.m_bAutoColor = TRUE; CBCGPDockManager::SetDockMode (BCGP_DT_SMART); break; case ID_VIEW_APPLOOK_VS2005: // enable VS 2005 look: CBCGPVisualManager::SetDefaultManager (RUNTIME_CLASS (CBCGPVisualManagerVS2005)); mdiTabParams.m_style = CBCGPTabWnd::STYLE_3D_VS2005; mdiTabParams.m_bDocumentMenu = TRUE; CBCGPDockManager::SetDockMode (BCGP_DT_SMART); break; case ID_VIEW_APPLOOK_VS2008: // enable VS 2008 look: CBCGPVisualManager::SetDefaultManager (RUNTIME_CLASS (CBCGPVisualManagerVS2008)); mdiTabParams.m_style = CBCGPTabWnd::STYLE_3D_VS2005; mdiTabParams.m_bDocumentMenu = TRUE; CBCGPDockManager::SetDockMode (BCGP_DT_SMART); break; case ID_VIEW_APPLOOK_VS2010: // enable VS 2010 look: CBCGPVisualManager::SetDefaultManager (RUNTIME_CLASS (CBCGPVisualManagerVS2010)); mdiTabParams.m_bDocumentMenu = TRUE; CBCGPDockManager::SetDockMode (BCGP_DT_SMART); break; } EnableMDITabbedGroups (TRUE, mdiTabParams); CBCGPDockManager* pDockManager = GetDockManager (); if (pDockManager != NULL) { ASSERT_VALID (pDockManager); pDockManager->AdjustBarFrames (); } CBCGPTabbedControlBar::ResetTabs (); RecalcLayout (); RedrawWindow (NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME | RDW_ERASE); theApp.WriteInt (_T("ApplicationLook"), m_nAppLook); }
void CMainFrame::UpdateMDITabs (BOOL bResetMDIChild) { TRACE("CMainFrame::UpdateMDITabs"); CMDITabInfo params; HWND hwndActive = NULL; switch (theApp.m_Options.m_nMDITabsType) { case CMDITabOptions::None: { BOOL bCascadeMDIChild = FALSE; if (IsMDITabbedGroup ()) { EnableMDITabbedGroups (FALSE, params); bCascadeMDIChild = TRUE; } else if (AreMDITabs ()) { EnableMDITabs (FALSE); bCascadeMDIChild = TRUE; } if (bCascadeMDIChild) { hwndActive = (HWND) m_wndClientArea.SendMessage (WM_MDIGETACTIVE); m_wndClientArea.PostMessage (WM_MDICASCADE); ::BringWindowToTop (hwndActive); } } break; case CMDITabOptions::MDITabsStandard: hwndActive = (HWND) m_wndClientArea.SendMessage (WM_MDIGETACTIVE); m_wndClientArea.PostMessage (WM_MDIMAXIMIZE, LPARAM(hwndActive), 0L); ::BringWindowToTop (hwndActive); EnableMDITabs (TRUE,theApp.m_Options.m_bMDITabsIcons, theApp.m_Options.m_bTabsOnTop ? CMFCTabCtrl::LOCATION_TOP : CMFCTabCtrl::LOCATION_BOTTOM, theApp.m_Options.m_nTabsStyle); GetMDITabs().EnableAutoColor (theApp.m_Options.m_bTabsAutoColor); GetMDITabs().EnableTabDocumentsMenu (theApp.m_Options.m_bMDITabsDocMenu); GetMDITabs().EnableTabSwap (theApp.m_Options.m_bDragMDITabs); GetMDITabs().SetTabBorderSize (theApp.m_Options.m_nMDITabsBorderSize); GetMDITabs().SetFlatFrame (theApp.m_Options.m_bFlatFrame); GetMDITabs().EnableCustomToolTips (theApp.m_Options.m_bCustomTooltips); GetMDITabs().EnableCustomToolTips (theApp.m_Options.m_bCustomTooltips); GetMDITabs().EnableActiveTabCloseButton (theApp.m_Options.m_bActiveTabCloseButton); break; case CMDITabOptions::MDITabbedGroups: hwndActive = (HWND) m_wndClientArea.SendMessage (WM_MDIGETACTIVE); m_wndClientArea.PostMessage (WM_MDIMAXIMIZE, LPARAM(hwndActive), 0L); ::BringWindowToTop (hwndActive); params.m_tabLocation = theApp.m_Options.m_bTabsOnTop ? CMFCTabCtrl::LOCATION_TOP : CMFCTabCtrl::LOCATION_BOTTOM; params.m_style = theApp.m_Options.m_nTabsStyle; params.m_bTabCloseButton = !theApp.m_Options.m_bActiveTabCloseButton; params.m_bActiveTabCloseButton = theApp.m_Options.m_bActiveTabCloseButton; params.m_bAutoColor = theApp.m_Options.m_bTabsAutoColor; params.m_bDocumentMenu = theApp.m_Options.m_bMDITabsDocMenu; params.m_bEnableTabSwap = theApp.m_Options.m_bDragMDITabs; params.m_nTabBorderSize = theApp.m_Options.m_nMDITabsBorderSize; params.m_bTabIcons = theApp.m_Options.m_bMDITabsIcons; params.m_bFlatFrame = theApp.m_Options.m_bFlatFrame; params.m_bTabCustomTooltips = theApp.m_Options.m_bCustomTooltips; EnableMDITabbedGroups (TRUE, params); break; } // Some "Windows..." commands are non-relevant when all MDI child windows are always maximized: CList<UINT, UINT> lstCommands; if (theApp.m_Options.IsMDITabsDisabled()) { lstCommands.AddTail (ID_WINDOW_CASCADE); lstCommands.AddTail (ID_WINDOW_TILE_HORZ); lstCommands.AddTail (ID_WINDOW_ARRANGE); } CMFCToolBar::SetNonPermittedCommands (lstCommands); if (bResetMDIChild) { // Adjust MDI child windows: BOOL bMaximize = !theApp.m_Options.IsMDITabsDisabled(); HWND hwndT = ::GetWindow(m_hWndMDIClient, GW_CHILD); while (hwndT != NULL) { CMDIChildWndEx* pFrame = DYNAMIC_DOWNCAST(CMDIChildWndEx, CWnd::FromHandle(hwndT)); if (pFrame != NULL) { ASSERT_VALID (pFrame); if (bMaximize) { pFrame->ModifyStyle(WS_SYSMENU, 0); } else { pFrame->ModifyStyle(0, WS_SYSMENU); pFrame->ShowWindow(SW_RESTORE); // Force a resize to happen on all the "restored" MDI child windows CRect rectFrame; pFrame->GetWindowRect(rectFrame); pFrame->SetWindowPos(NULL, -1, -1, rectFrame.Width() + 1, rectFrame.Height(), SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE); pFrame->SetWindowPos(NULL, -1, -1, rectFrame.Width(), rectFrame.Height(), SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE); } } hwndT = ::GetWindow(hwndT, GW_HWNDNEXT); } if (bMaximize) { m_wndMenuBar.SetMaximizeMode (FALSE); } } if (m_wndWorkSpace.IsAutoHideMode ()) { m_wndWorkSpace.BringWindowToTop (); CPaneDivider* pSlider = m_wndWorkSpace.GetDefaultPaneDivider (); if (pSlider != NULL) { pSlider->BringWindowToTop (); } } if (m_wndWorkSpace2.IsAutoHideMode ()) { m_wndWorkSpace2.BringWindowToTop (); CPaneDivider* pSlider = m_wndWorkSpace2.GetDefaultPaneDivider (); if (pSlider != NULL) { pSlider->BringWindowToTop (); } } CMDIFrameWndEx::m_bDisableSetRedraw = theApp.m_Options.m_bDisableMDIChildRedraw; RecalcLayout (); RedrawWindow (NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE); }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CBCGPMDIFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; if (CBCGPToolBar::GetUserImages () == NULL) { // Load toolbar user images: if (!m_UserImages.Load (_T(".\\UserImages.bmp"))) { TRACE(_T("Failed to load user images\n")); } else { CBCGPToolBar::SetUserImages (&m_UserImages); } } CBCGPToolBar::EnableQuickCustomization (); // TODO: Define your own basic commands. Be sure, that each pulldown // menu have at least one basic command. CList<UINT, UINT> lstBasicCommands; // lstBasicCommands.AddTail (ID_VIEW_TOOLBARS); // lstBasicCommands.AddTail (ID_FILE_NEW); // lstBasicCommands.AddTail (ID_FILE_OPEN); // lstBasicCommands.AddTail (ID_FILE_SAVE); // lstBasicCommands.AddTail (ID_FILE_PRINT); lstBasicCommands.AddTail (ID_APP_EXIT); // lstBasicCommands.AddTail (ID_EDIT_CUT); // lstBasicCommands.AddTail (ID_EDIT_PASTE); // lstBasicCommands.AddTail (ID_EDIT_UNDO); // lstBasicCommands.AddTail (ID_RECORD_NEXT); // lstBasicCommands.AddTail (ID_RECORD_LAST); lstBasicCommands.AddTail (ID_APP_ABOUT); lstBasicCommands.AddTail (ID_VIEW_TOOLBAR); lstBasicCommands.AddTail (ID_VIEW_CUSTOMIZE); lstBasicCommands.AddTail (ID_WINDOW_TILE_HORZ); // lstBasicCommands.AddTail (ID_VIEW_APPLOOK_2000); // lstBasicCommands.AddTail (ID_VIEW_APPLOOK_XP); // lstBasicCommands.AddTail (ID_VIEW_APPLOOK_2003); // lstBasicCommands.AddTail (ID_VIEW_APPLOOK_2007); // lstBasicCommands.AddTail (ID_VIEW_APPLOOK_VS2005); lstBasicCommands.AddTail (ID_VIEW_APPLOOK_WIN_XP); // lstBasicCommands.AddTail (ID_VIEW_APPLOOK_2007_1); // lstBasicCommands.AddTail (ID_VIEW_APPLOOK_2007_2); // lstBasicCommands.AddTail (ID_VIEW_APPLOOK_2007_3); // lstBasicCommands.AddTail (ID_VIEW_APPLOOK_VS2008); CBCGPToolBar::SetBasicCommands (lstBasicCommands); if (!m_wndMenuBar.Create (this)) { TRACE0("Failed to create menubar\n"); return -1; // fail to create } m_wndMenuBar.SetBarStyle(m_wndMenuBar.GetBarStyle() | CBRS_SIZE_DYNAMIC); // Detect color depth. 256 color toolbars can be used in the // high or true color modes only (bits per pixel is > 8): CClientDC dc (this); BOOL bIsHighColor = dc.GetDeviceCaps (BITSPIXEL) > 8; UINT uiToolbarHotID = bIsHighColor ; // if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP // | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || // !m_wndToolBar.LoadToolBar(IDR_MAINFRAME_256, 0, 0, FALSE, 0, 0, uiToolbarHotID)) // { // TRACE0("Failed to create toolbar\n"); // return -1; // fail to create // } if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(theApp.m_bHiColorIcons ? IDR_MAINFRAME_256 : IDR_MAINFRAME)) { TRACE0("未能创建工具栏\n"); return -1; // 未能创建 } CString strToolBarName; BOOL bNameValid = strToolBarName.LoadString(IDS_TOOLBAR_STANDARD); ASSERT(bNameValid); m_wndToolBar.SetWindowText(strToolBarName); if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } // Load control bar icons: CBCGPToolBarImages imagesWorkspace; imagesWorkspace.SetImageSize (CSize (16, 16)); imagesWorkspace.SetTransparentColor (RGB (255, 0, 255)); imagesWorkspace.Load (IDB_WORKSPACE); if (!m_wndWorkSpace.Create (_T("方案管理器"), this, CRect (0, 0, 200, 200), TRUE, ID_VIEW_WORKSPACE, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI)) { TRACE0("Failed to create Workspace bar\n"); return -1; // fail to create } m_wndWorkSpace.SetIcon (imagesWorkspace.ExtractIcon (0), FALSE); if (!m_wndOutput.Create (_T("输出"), this, CSize (150, 150), TRUE /* Has gripper */, ID_VIEW_OUTPUT, WS_CHILD | WS_VISIBLE | CBRS_BOTTOM)) { TRACE0("Failed to create output bar\n"); return -1; // fail to create } CString strMainToolbarTitle; strMainToolbarTitle.LoadString (IDS_MAIN_TOOLBAR); m_wndToolBar.SetWindowText (strMainToolbarTitle); // TODO: Delete these three lines if you don't want the toolbar to be dockable m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY); m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); m_wndWorkSpace.EnableDocking(CBRS_ALIGN_ANY); m_wndOutput.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); EnableAutoHideBars(CBRS_ALIGN_ANY); DockControlBar(&m_wndMenuBar); DockControlBar(&m_wndToolBar); DockControlBar(&m_wndWorkSpace); DockControlBar(&m_wndOutput); m_wndToolBar.EnableCustomizeButton (TRUE, ID_VIEW_CUSTOMIZE, _T("自定义...")); // Allow user-defined toolbars operations: InitUserToobars (NULL, uiFirstUserToolBarId, uiLastUserToolBarId); // Enable windows manager: EnableWindowsDialog (ID_WINDOW_MANAGER, IDS_WINDOWS_MANAGER, TRUE); // Enable control bar context menu (list of bars + customize command): EnableControlBarMenu ( TRUE, // Enable ID_VIEW_CUSTOMIZE, // Customize command ID _T("自定义..."), // Customize command text ID_VIEW_TOOLBAR); // Menu items with this ID will be replaced by // toolbars menu OnApplicationLook (theApp.m_nAppLook); #if 0 BOOL bNameValid; // 基于持久值设置视觉管理器和样式 OnApplicationLook(theApp.m_nAppLook); CMDITabInfo mdiTabParams; mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; // 其他可用样式... mdiTabParams.m_bActiveTabCloseButton = TRUE; // 设置为 FALSE 会将关闭按钮放置在选项卡区域的右侧 mdiTabParams.m_bTabIcons = FALSE; // 设置为 TRUE 将在 MDI 选项卡上启用文档图标 mdiTabParams.m_bAutoColor = TRUE; // 设置为 FALSE 将禁用 MDI 选项卡的自动着色 mdiTabParams.m_bDocumentMenu = TRUE; // 在选项卡区域的右边缘启用文档菜单 EnableMDITabbedGroups(TRUE, mdiTabParams); if (!m_wndMenuBar.Create(this)) { TRACE0("未能创建菜单栏\n"); return -1; // 未能创建 } m_wndMenuBar.SetPaneStyle(m_wndMenuBar.GetPaneStyle() | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY); // 防止菜单栏在激活时获得焦点 CMFCPopupMenu::SetForceMenuFocus(FALSE); if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(theApp.m_bHiColorIcons ? IDR_MAINFRAME_256 : IDR_MAINFRAME)) { TRACE0("未能创建工具栏\n"); return -1; // 未能创建 } CString strToolBarName; bNameValid = strToolBarName.LoadString(IDS_TOOLBAR_STANDARD); ASSERT(bNameValid); m_wndToolBar.SetWindowText(strToolBarName); CString strCustomize; bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE); ASSERT(bNameValid); m_wndToolBar.EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize); // 允许用户定义的工具栏操作: InitUserToolbars(NULL, uiFirstUserToolBarId, uiLastUserToolBarId); if (!m_wndStatusBar.Create(this)) { TRACE0("未能创建状态栏\n"); return -1; // 未能创建 } m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)); // TODO: 如果您不希望工具栏和菜单栏可停靠,请删除这五行 m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY); m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndMenuBar); DockPane(&m_wndToolBar); // 启用 Visual Studio 2005 样式停靠窗口行为 CDockingManager::SetDockingMode(DT_SMART); // 启用 Visual Studio 2005 样式停靠窗口自动隐藏行为 EnableAutoHidePanes(CBRS_ALIGN_ANY); // 加载菜单项图像(不在任何标准工具栏上): CBCGPToolBar::AddToolBarForImageCollection(IDR_MENU_IMAGES, theApp.m_bHiColorIcons ? IDB_MENU_IMAGES_24 : 0); // 创建停靠窗口 if (!CreateDockingWindows()) { TRACE0("未能创建停靠窗口\n"); return -1; } m_wndFileView.EnableDocking(CBRS_ALIGN_ANY); m_wndClassView.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndFileView); CBCGPDockingControlBar* pTabbedBar = NULL; m_wndClassView.AttachToTabWnd(&m_wndFileView, DM_SHOW, TRUE, &pTabbedBar); m_wndOutput.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndOutput); // 启用增强的窗口管理对话框 EnableWindowsDialog(ID_WINDOW_MANAGER, IDS_WINDOWS_MANAGER, TRUE); // 启用工具栏和停靠窗口菜单替换 EnablePaneMenu(TRUE, ID_VIEW_CUSTOMIZE, strCustomize, ID_VIEW_TOOLBAR); // 启用快速(按住 Alt 拖动)工具栏自定义 CBCGPToolBar::EnableQuickCustomization(); if (CBCGPToolBar::GetUserImages() == NULL) { // 加载用户定义的工具栏图像 if (m_UserImages.Load(_T(".\\UserImages.bmp"))) { m_UserImages.SetImageSize(CSize(16, 16), FALSE); CBCGPToolBar::SetUserImages(&m_UserImages); } } // 启用菜单个性化(最近使用的命令) // TODO: 定义您自己的基本命令,确保每个下拉菜单至少有一个基本命令。 CList<UINT, UINT> lstBasicCommands; lstBasicCommands.AddTail(ID_FILE_NEW); lstBasicCommands.AddTail(ID_FILE_OPEN); lstBasicCommands.AddTail(ID_FILE_SAVE); lstBasicCommands.AddTail(ID_FILE_PRINT); lstBasicCommands.AddTail(ID_APP_EXIT); lstBasicCommands.AddTail(ID_EDIT_CUT); lstBasicCommands.AddTail(ID_EDIT_PASTE); lstBasicCommands.AddTail(ID_EDIT_UNDO); lstBasicCommands.AddTail(ID_APP_ABOUT); lstBasicCommands.AddTail(ID_VIEW_STATUS_BAR); lstBasicCommands.AddTail(ID_VIEW_TOOLBAR); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2003); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_VS_2005); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_BLUE); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_SILVER); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_BLACK); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_AQUA); lstBasicCommands.AddTail(ID_SORTING_SORTALPHABETIC); lstBasicCommands.AddTail(ID_SORTING_SORTBYTYPE); lstBasicCommands.AddTail(ID_SORTING_SORTBYACCESS); lstBasicCommands.AddTail(ID_SORTING_GROUPBYTYPE); CBCGPToolBar::SetBasicCommands(lstBasicCommands); #endif return 0; }
void CMainFrame::OnAppLook(UINT id) { CDockingManager::SetDockingMode(DT_SMART); m_nAppLook = id; CTabbedPane::m_StyleTabWnd = CMFCTabCtrl::STYLE_3D; switch (m_nAppLook) { case ID_VIEW_APPLOOK_2007: case ID_VIEW_APPLOOK_2007_1: case ID_VIEW_APPLOOK_2007_2: case ID_VIEW_APPLOOK_2007_3: // enable Office 2007 look: switch (m_nAppLook) { case ID_VIEW_APPLOOK_2007: CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_LunaBlue); break; case ID_VIEW_APPLOOK_2007_1: CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_ObsidianBlack); break; case ID_VIEW_APPLOOK_2007_2: CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Silver); break; case ID_VIEW_APPLOOK_2007_3: CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Aqua); break; } CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2007)); CDockingManager::SetDockingMode(DT_SMART); break; } CMDITabInfo mdiTabParams; mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_VS2005; mdiTabParams.m_bAutoColor = TRUE; mdiTabParams.m_bDocumentMenu = TRUE; mdiTabParams.m_bActiveTabCloseButton = TRUE; EnableMDITabbedGroups(TRUE, mdiTabParams); CDockingManager* pDockManager = GetDockingManager(); if (pDockManager != NULL) { ASSERT_VALID(pDockManager); pDockManager->AdjustPaneFrames(); } CTabbedPane::ResetTabs(); RecalcLayout(); RedrawWindow(NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE); theApp.WriteInt(_T("ApplicationLook"), m_nAppLook); }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1) return -1; BOOL bNameValid; // 보관된 값에 따라 비주얼 관리자 및 스타일을 설정합니다. OnApplicationLook(theApp.m_nAppLook); CMDITabInfo mdiTabParams; mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; // 사용할 수 있는 다른 스타일... mdiTabParams.m_bActiveTabCloseButton = TRUE; // FALSE로 설정하여 탭 영역 오른쪽에 닫기 단추를 배치합니다. mdiTabParams.m_bTabIcons = FALSE; // TRUE로 설정하여 MDI 탭의 문서 아이콘을 활성화합니다. mdiTabParams.m_bAutoColor = TRUE; // FALSE로 설정하여 MDI 탭의 자동 색 지정을 비활성화합니다. mdiTabParams.m_bDocumentMenu = TRUE; // 탭 영역의 오른쪽 가장자리에 문서 메뉴를 활성화합니다. EnableMDITabbedGroups(TRUE, mdiTabParams); if (!m_wndMenuBar.Create(this)) { TRACE0("메뉴 모음을 만들지 못했습니다.\n"); return -1; // 만들지 못했습니다. } m_wndMenuBar.SetPaneStyle(m_wndMenuBar.GetPaneStyle() | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY); // 메뉴 모음을 활성화해도 포커스가 이동하지 않게 합니다. CMFCPopupMenu::SetForceMenuFocus(FALSE); if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(theApp.m_bHiColorIcons ? IDR_MAINFRAME_256 : IDR_MAINFRAME)) { TRACE0("도구 모음을 만들지 못했습니다.\n"); return -1; // 만들지 못했습니다. } CString strToolBarName; bNameValid = strToolBarName.LoadString(IDS_TOOLBAR_STANDARD); ASSERT(bNameValid); m_wndToolBar.SetWindowText(strToolBarName); CString strCustomize; bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE); ASSERT(bNameValid); m_wndToolBar.EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize); if (!m_wndStatusBar.Create(this)) { TRACE0("상태 표시줄을 만들지 못했습니다.\n"); return -1; // 만들지 못했습니다. } m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)); // TODO: 도구 모음 및 메뉴 모음을 도킹할 수 없게 하려면 이 다섯 줄을 삭제하십시오. m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY); m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndMenuBar); DockPane(&m_wndToolBar); // Visual Studio 2005 스타일 도킹 창 동작을 활성화합니다. CDockingManager::SetDockingMode(DT_SMART); // Visual Studio 2005 스타일 도킹 창 자동 숨김 동작을 활성화합니다. EnableAutoHidePanes(CBRS_ALIGN_ANY); // 도킹 창을 만듭니다. if (!CreateDockingWindows()) { TRACE0("도킹 창을 만들지 못했습니다.\n"); return -1; } m_wndOutput.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndOutput); // 향상된 창 관리 대화 상자를 활성화합니다. EnableWindowsDialog(ID_WINDOW_MANAGER, ID_WINDOW_MANAGER, TRUE); // 도구 모음 및 도킹 창 메뉴 바꾸기를 활성화합니다. EnablePaneMenu(TRUE, ID_VIEW_CUSTOMIZE, strCustomize, ID_VIEW_TOOLBAR); // 빠른(<Alt> 키를 누른 채 끌기) 도구 모음 사용자 지정을 활성화합니다. CMFCToolBar::EnableQuickCustomization(); // 창 제목 표시줄에서 문서 이름 및 응용 프로그램 이름의 순서를 전환합니다. // 문서 이름이 축소판 그림과 함께 표시되므로 작업 표시줄의 기능성이 개선됩니다. ModifyStyle(0, FWS_PREFIXTITLE); return 0; }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; CMFCVisualManager::SetDefaultManager (RUNTIME_CLASS (CMFCVisualManagerOffice2007)); CMDITabInfo mdiTabParams; mdiTabParams.m_bTabIcons = TRUE; mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; mdiTabParams.m_bAutoColor = TRUE; EnableMDITabbedGroups (TRUE, mdiTabParams); CDockingManager::SetDockingMode (DT_SMART); m_wndRibbonBar.Create (this); InitRibbon (); if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } // Load control bar icons: CMFCToolBarImages imagesWorkspace; imagesWorkspace.SetImageSize (CSize (16, 16)); imagesWorkspace.SetTransparentColor (RGB (255, 0, 255)); imagesWorkspace.Load (IDB_WORKSPACE); if (!m_wndWorkSpace.Create (_T("View 1"), this, CRect (0, 0, 200, 200), TRUE, ID_VIEW_WORKSPACE, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI)) { TRACE0("Failed to create Workspace bar\n"); return FALSE; // fail to create } m_wndWorkSpace.SetIcon (imagesWorkspace.ExtractIcon (0), FALSE); if (!m_wndWorkSpace2.Create (_T("View 2"), this, CRect (0, 0, 200, 200), TRUE, ID_VIEW_WORKSPACE2, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI)) { TRACE0("Failed to create Workspace bar 2\n"); return FALSE; // fail to create } m_wndWorkSpace2.SetIcon (imagesWorkspace.ExtractIcon (1), FALSE); if (!m_wndOutput.Create (_T("Output"), this, CRect (0, 0, 150, 150), TRUE /* Has gripper */, ID_VIEW_OUTPUT, WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_FLOAT_MULTI)) { TRACE0("Failed to create output bar\n"); return -1; // fail to create } m_wndOutput.SetIcon (imagesWorkspace.ExtractIcon (2), FALSE); m_wndWorkSpace.EnableDocking(CBRS_ALIGN_ANY); m_wndWorkSpace2.EnableDocking(CBRS_ALIGN_ANY); m_wndOutput.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); EnableAutoHidePanes(CBRS_ALIGN_ANY); DockPane (&m_wndWorkSpace); m_wndWorkSpace2.AttachToTabWnd (&m_wndWorkSpace, DM_STANDARD, FALSE, NULL); DockPane(&m_wndOutput); // Enable windows manager: EnableWindowsDialog (ID_WINDOW_MANAGER, IDS_WINDOWS_MANAGER, TRUE); return 0; }