如何将CMFCToolBar(水平)停靠在窗口的左侧 [英] How to dock a CMFCToolBar (horizontal) on the left side of the window

查看:619
本文介绍了如何将CMFCToolBar(水平)停靠在窗口的左侧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将一个水平工具栏(CMFCToolBar)停靠在窗口的左上角。

I want to dock a horizontal toolbar (CMFCToolBar) on the upper left position of the window.

我试图调用DockPane(工具栏),但它总是将工具栏停靠在窗口的右上角位置。如何将工具栏移动到窗口的左上角?

I've tried to call DockPane(toolbar), but it always docks the toolbar on the upper right position of the window. How to move the toolbar to the upper left of the window?

谢谢

推荐答案

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);





这篇关于如何将CMFCToolBar(水平)停靠在窗口的左侧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆