且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将CMFCToolBar(水平)停靠在窗口的左侧

更新时间:2023-02-10 23:29:25

I添加了这些行 在CMainFrame :: OnCreate()中,我可以看到工具栏停靠在左上角。

I added these lines  in CMainFrame::OnCreate() and I can see the toolbar docked to the top left.

-Seetharam

-Seetharam

	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;
	strToolBarName.LoadString(IDS_TOOLBAR_STANDARD);
	m_wndToolBar.SetWindowText(strToolBarName);

	CString strCustomize;
    strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE);
	m_wndToolBar.EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize);

	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
	EnableDocking(CBRS_ALIGN_ANY);
	DockPane(&m_wndToolBar);