int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CBCGPMDIFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; HICON m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); SetIcon(m_hIcon, TRUE); // Set big icon // Menu will not take the focus on activation: CBCGPPopupMenu::SetForceMenuFocus (FALSE); EnableDocking(CBRS_ALIGN_TOP); 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); m_wndMenuBar.SetRecentlyUsedMenus(FALSE); //不加这句话,菜单初始时,只显示一个下拉键头,不显示全部菜单项. // 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 ? IDB_TOOLBAR256 : 0; 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 } // TODO: Delete these three lines if you don't want the toolbar to be dockable m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); EnableAutoHideBars(CBRS_ALIGN_ANY); DockControlBar(&m_wndMenuBar); CreateMineToolBar(); // 创建工具栏 m_MineToolbar.EnableDocking(CBRS_ALIGN_ANY); DockControlBar(&m_MineToolbar); // Allow user-defined toolbars operations: InitUserToobars (NULL, uiFirstUserToolBarId, uiLastUserToolBarId); AdjustClientArea(); // Enable windows manager: EnableWindowsDialog (ID_WINDOW_MANAGER, IDS_WINDOWS_MANAGER, TRUE); OnAppLook (m_nAppLook); SetWindowText("综合设计环境"); SetTitle( "综合设计环境" ); // VISUAL_MANAGER return 0; }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CBCGPFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; CBCGPToolbarComboBoxButton::SetFlatMode (); CBCGPToolBar::EnableQuickCustomization (); //-------------------------------- // Création du rubban //-------------------------------- if (!CreateRibbonBar()) { TRACE0("Failed to create ribbon bar\n"); return -1; // fail to create } //-------------------------------- // Création des barres ancrables //-------------------------------- if (!CreateDockingBars()) { TRACE0("Failed to create docking bars\n"); return -1; // fail to create } //-------------------------------- // Création de la barre de status //-------------------------------- if (!m_wndStatusBar.Create(this)) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } CBCGPToolBar::SetMenuSizes (CSize (22, 22), CSize (16, 16)); CBCGPToolBar::AddToolBarForImageCollection (IDR_TOOLBAR_IMAGES , IDB_TOOLBAR_IMAGES_16 // Hot , IDB_TOOLBAR_IMAGES_16 // Cold , IDB_TOOLBAR_IMAGES_16 // Menu , IDB_TOOLBAR_IMAGES_D16 // Disable , IDB_TOOLBAR_IMAGES_D16); // Menu Disable // Ancrage m_wndPropertiesBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); EnableAutoHideBars(CBRS_ALIGN_ANY); DockControlBar(&m_wndPropertiesBar); return 0; }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CBCGPFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; OnAppLook(m_nAppLook); EnableDocking(CBRS_ALIGN_LEFT | CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM | CBRS_ALIGN_RIGHT); if (!CreateCommonBar()) { return -1; } EnableDocking(CBRS_ALIGN_LEFT); if (!CreateTaskPane()) { return -1; } if (!CreateOutPut()) { return -1; } EnableAutoHideBars(CBRS_ALIGN_LEFT); if (!RegisterHotKey(m_hWnd, 1, MOD_CONTROL, 'Q')) { MessageBox(_T("注册热键Ctrl+Atl+Q失败"), _T("错误"),MB_OK|MB_ICONWARNING); } #ifdef DEBUG SetTimer(1006, 60000, NULL); #else SetTimer(1006, 3600*1000, NULL); #endif OnCreateEnd(); return 0; }
int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CBCGPMDIChildWnd::OnCreate(lpCreateStruct) == -1) return -1; CString strTemp; BOOL bNameVaild = strTemp.LoadString(IDS_STRING_OUTPUT); ASSERT(bNameVaild); if (!m_wndOutput.Create(strTemp, this, CRect(0, 0, 200, 100), TRUE, ID_OUTPUT_BAR, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_BOTTOM)) { TRACE(_T("Failed to create output bar\n")); return FALSE; } m_wndOutput.SetIcon(AfxGetApp()->LoadIcon(IDI_OUTPUT_BAR_HC), FALSE); EnableDocking(CBRS_ALIGN_ANY); EnableAutoHideBars(CBRS_ALIGN_ANY); GetDockManager()->EnableDockBarMenu(TRUE); m_wndOutput.EnableDocking(CBRS_ALIGN_ANY); DockControlBar(&m_wndOutput); m_wndOutput.ShowControlBar(FALSE, FALSE, FALSE); return 0; }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CBCGPFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; CBCGPToolBar::EnableQuickCustomization(); 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)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } 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 three lines if you don't want the toolbar to be dockable //m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY); m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); EnableAutoHideBars(CBRS_ALIGN_ANY); //DockControlBar(&m_wndMenuBar); DockControlBar(&m_wndToolBar); return 0; }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; // enable Windows XP look (in other OS Office XP look will be used): CBCGPVisualManager::SetDefaultManager (RUNTIME_CLASS (CVisualManager)); CBCGPDockManager::SetDockMode (BCGP_DT_STANDARD); CBCGPToolBar::m_dblLargeImageRatio = 1.2; CBCGPToolBar::SetSizes (CSize (22, 22), CSize (16, 16)); CBCGPToolBar::SetMenuSizes (CBCGPToolBar::GetMenuButtonSize (), CSize (16, 16)); // 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); theApp.m_nColorMode = (WORD)dc.GetDeviceCaps (BITSPIXEL); //----------------------- // Create the addressbar: //----------------------- CBCGPToolbarComboBoxButton::SetFlatMode (FALSE); CBCGPToolbarEditBoxButton::SetFlatMode (FALSE); m_wndAddressBar.EnableNavigationButtons (ID_GOTO_BACK, ID_GOTO_FORWARD, ID_GOTO_HISTORY, ID_VIEW_HISTORY, 0); if (!m_wndAddressBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndAddressBar.LoadToolBar (IDR_ADDRESS_BAR, theApp.m_nColorMode >= 16 ? IDB_ADDRESS_BAR : 0, 0, 0, theApp.m_nColorMode >= 16 ? IDB_ADDRESS_BAR_120 : 0)) { TRACE0("Failed to create addressbar\n"); return -1; // fail to create } m_wndAddressBar.ReplaceButton (IDC_ADDRESS, CBCGPToolbarComboBoxButton (IDC_ADDRESS, -1, CBS_DROPDOWN)); m_wndAddressBar.SetStretchID (IDC_ADDRESS); m_wndAddressBar.ReplaceButton (IDC_SEARCH, CBCGPToolbarEditBoxButton (IDC_SEARCH, -1)); CMenu menu; VERIFY (menu.LoadMenu (IDR_SEARCH_POPUP)); CMenu* pMenuSearch = menu.GetSubMenu (0); VERIFY (pMenuSearch != NULL); m_wndAddressBar.ReplaceButton (ID_GOTO_SEARCH, CBCGPToolbarMenuButton (ID_GOTO_SEARCH, pMenuSearch->GetSafeHmenu (), 4)); //-------------------- // Create the menubar: //-------------------- if (!m_wndMenuBar.CreateEx (this, TBSTYLE_TRANSPARENT)) { TRACE0("Failed to create menubar\n"); return -1; // fail to create } m_wndMenuBar.SetBarStyle ((m_wndMenuBar.GetBarStyle() & ~(CBRS_GRIPPER | CBRS_BORDER_ANY)) | CBRS_SIZE_DYNAMIC); m_wndMenuBar.EnableCustomizeButton (TRUE, (UINT)-1, _T("")); //------------------ // Create links bar: //------------------ if (!m_wndLinksBar.CreateEx (this, TBSTYLE_TRANSPARENT, dwDefaultToolbarStyle, CRect(0, 0, 0, 0), AFX_IDW_DIALOGBAR + 1)) { TRACE0("Failed to create linksbar\n"); } CString strLinksLabel; strLinksLabel.LoadString (IDS_LINKSBAR_NAME); m_wndLinksBar.SetWindowText (strLinksLabel); m_wndLinksBar.SetBarStyle (m_wndLinksBar.GetBarStyle() & ~(CBRS_GRIPPER | CBRS_BORDER_ANY)); m_wndLinksBar.EnableCustomizeButton (TRUE, (UINT)-1, _T("")); //-------------- // Create rebar: //-------------- m_wndReBar.LockBars (); if (!m_wndReBar.Create(this) || !m_wndReBar.AddBar(&m_wndMenuBar, NULL, NULL, RBBS_GRIPPERALWAYS | RBBS_FIXEDBMP | RBBS_BREAK | RBBS_HIDDEN) || !m_wndReBar.AddBar(&m_wndLinksBar, strLinksLabel, NULL, RBBS_GRIPPERALWAYS | RBBS_FIXEDBMP | RBBS_BREAK)) { TRACE0("Failed to create rebar\n"); return -1; // fail to create } m_wndMenuBar.AdjustLayout (); m_wndLinksBar.AdjustLayout (); //--------------- // Create tabbar: //--------------- if (!m_wndTabBar.Create (_T(""), this, FALSE, MAKEINTRESOURCE(IDD_TAB_BAR), CBRS_SIZE_DYNAMIC | CBRS_ALIGN_TOP | CBRS_TOOLTIPS | CBRS_FLYBY, AFX_IDW_DIALOGBAR + 2, CBRS_BCGP_REGULAR_TABS, 0)) { TRACE0("Failed to create addressbar\n"); return -1; // fail to create } EnableDocking(CBRS_ALIGN_ANY); m_wndReBar.EnableDocking (CBRS_TOP); m_wndTabBar.EnableDocking (CBRS_TOP); DockControlBar (&m_wndReBar); DockControlBar (&m_wndTabBar); ShowControlBar (&m_wndMenuBar, FALSE, FALSE, FALSE); ShowControlBar (&m_wndTabBar, TRUE, FALSE, FALSE); //------------------- // Create status bar: //------------------- if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create statusbar\n"); return -1; // fail to create } //------------------------------ // First pane - image/animation: //------------------------------ m_wndStatusBar.SetPaneStyle (nStatusInfo, SBPS_STRETCH | SBPS_NOBORDERS); m_wndStatusBar.SetPaneWidth (nStatusProgress, 80); m_wndMenuBar.SetBarStyle(m_wndMenuBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY); m_wndLinksBar.SetBarStyle(m_wndLinksBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY); //----------------------- // Set up Favorites menu: //----------------------- VERIFY (theApp.m_Favorites.CreateMenu (m_menuFavotites)); // Load control bar icons: CBCGPToolBarImages imagesExplorer; imagesExplorer.SetImageSize (CSize (16, 16)); if (theApp.m_nColorMode >= 16) { imagesExplorer.SetTransparentColor (RGB (255, 0, 255)); } imagesExplorer.Load ( theApp.m_nColorMode >= 16 ? IDB_EXPLORER_32 : theApp.m_nColorMode >= 8 ? IDB_EXPLORER_256 : IDB_EXPLORER ); if (!m_wndExplorer.Create (_T("Favorites Center"), this, CRect (0, 0, 200, 200), TRUE, ID_VIEW_FAVORITES_CENTER, 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_wndExplorer.SetIcon (imagesExplorer.ExtractIcon (0), FALSE); m_wndExplorer.EnableDocking(CBRS_ALIGN_LEFT); EnableDocking(CBRS_ALIGN_ANY); EnableAutoHideBars(CBRS_ALIGN_ANY); DockControlBar (&m_wndExplorer); // Enable windows manager: EnableWindowsDialog (ID_WINDOW_MANAGER, IDS_WINDOWS_MANAGER, TRUE); UINT nTicID = 0; if (theApp.m_nColorMode >= 16) { nTicID = IDR_TOOLBAR_IC_32; } else if (theApp.m_nColorMode >= 8) { nTicID = IDR_TOOLBAR_IC_256; } CBCGPToolBar::AddToolBarForImageCollection ( IDR_TOOLBAR_IC, // Toolbar (need for map "Command - Image") nTicID, // "Hot" images nTicID, // "Cold" images nTicID); // Menu images EnableFullScreenMode(ID_VIEW_FULLSCREEN); return 0; }
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 CChildFrame::CreateJiaomoBar() { if (theApp.m_pBarJianmoTree == NULL) { theApp.m_pBarJianmoTree = new CBarStructTree(); } if (!IsWindow(theApp.m_pBarJianmoTree->GetSafeHwnd())) { if ( !theApp.m_pBarJianmoTree->Create ( _T("结构树") , this , CRect (0, 0, 330, 200) , TRUE // Has gripper , ID_BAR_JIANMO_TREE , WS_CHILD | WS_VISIBLE | CBRS_LEFT , CBRS_BCGP_REGULAR_TABS , /*CBRS_BCGP_FLOAT |*/ /*CBRS_BCGP_CLOSE |*/ CBRS_BCGP_RESIZE | CBRS_BCGP_AUTOHIDE ) ) { return; // fail to create } } ////////////////////////////////////////////////////////////////////////// if (theApp.m_pBarJianmoComponentLib == NULL) { theApp.m_pBarJianmoComponentLib = new CBarResLib(); } if (!IsWindow(theApp.m_pBarJianmoComponentLib->GetSafeHwnd())) { if ( !theApp.m_pBarJianmoComponentLib->Create ( _T("组件资源库") , this , CRect (0, 0, 200, 200) , TRUE // Has gripper , ID_BAR_JIANMO_COMPONENTLIB , WS_CHILD | WS_VISIBLE | CBRS_BOTTOM , CBRS_BCGP_REGULAR_TABS , /*CBRS_BCGP_FLOAT |*/ /*CBRS_BCGP_CLOSE |*/ CBRS_BCGP_RESIZE | CBRS_BCGP_AUTOHIDE ) ) { return; // fail to create } } ShowControlBar (theApp.m_pBarJianmoComponentLib , TRUE //!(theApp.m_pBarJianmoTree->GetStyle () & WS_VISIBLE) , FALSE , TRUE ); ShowControlBar (theApp.m_pBarJianmoTree , TRUE //!(theApp.m_pBarJianmoTree->GetStyle () & WS_VISIBLE) , FALSE , TRUE ); theApp.m_pBarJianmoComponentLib->EnableDocking(CBRS_ALIGN_ANY); theApp.m_pBarJianmoTree->EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); EnableAutoHideBars(CBRS_ALIGN_ANY); //DockControlBar( theApp.m_pBarJianmoComponentLib ); //DockControlBar( theApp.m_pBarJianmoTree ); //theApp.m_pBarJianmoComponentLib->SetLastPercentInContainer(30); //ShowControlBar (theApp.m_pBarJianmoTree // , TRUE //!(theApp.m_pBarJianmoTree->GetStyle () & WS_VISIBLE) // , FALSE // , TRUE ); //AdjustDockingLayout(); //CString strUrl; //CRect rcClient; //GetClientRect(&rcClient); ////任务列表//////////////////////////////////////////////////////////////////////// //if (theApp.m_pBarExecEnvTaskTree == NULL) //{ // theApp.m_pBarExecEnvTaskTree = new CGfxFloatBarWeb(); // theApp.m_pBarExecEnvTaskTree->m_strWebFlag = WEBFLAG_TASKTREE; //} //if (!IsWindow(theApp.m_pBarExecEnvTaskTree->GetSafeHwnd())) //{ // //ZHD-618 // if (!theApp.m_pBarExecEnvTaskTree->Create ( // IDC_BAR_EXECENV_TASKTREE // , _T("任务列表") // , this // , CBRS_ALIGN_LEFT // , CBRS_ALIGN_LEFT // , CBRS_ALIGN_LEFT // , 0, 0, 290, 290 // , NULL // , CBRS_BCGP_REGULAR_TABS // , CGfxFloatBar::DEFAULT_STYLE | CBRS_BCGP_FLOAT // , CBRS_BCGP_RESIZE | CBRS_BCGP_AUTOHIDE | CBRS_BCGP_FLOAT)) // { // TRACE0("Failed to create dialogbar\n"); // return FALSE; // fail to create // } // theApp.m_pBarExecEnvTaskTree->Navigate(theApp.m_strTaskTreeUrl); //} }