📄 subject_15814.htm
字号:
<p>
序号:15814 发表者:小黑 发表日期:2002-09-22 16:21:21
<br>主题:请教:vc 中toolbar怎么多列显示?如画图板中的工具条
<br>内容:vc 中toolbar怎么多列显示?如画图板中的工具条<BR><BR>我自己创建的工具条总是单列的
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:Aikoc 回复日期:2002-09-22 17:19:36
<br>内容: m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);<BR> m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);<BR> EnableDocking(CBRS_ALIGN_ANY);<BR> DockControlBar(&m_wndMenuBar);<BR> DockControlBar(&m_wndToolBar);<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:Aikoc 回复日期:2002-09-22 17:21:29
<br>内容:see MSDN<BR><BR>CControlBar::EnableDocking<BR>void EnableDocking( DWORD dwStyle );<BR><BR>Parameters<BR><BR>dwStyle<BR><BR>Specifies whether the control bar supports docking and the sides of its parent window to which the control bar can be docked, if supported. Can be one or more of the following: <BR><BR>CBRS_ALIGN_TOP Allows docking at the top of the client area.<BR><BR><BR>CBRS_ALIGN_BOTTOM Allows docking at the bottom of the client area.<BR><BR><BR>CBRS_ALIGN_LEFT Allows docking on the left side of the client area.<BR><BR><BR>CBRS_ALIGN_RIGHT Allows docking on the right side of the client area.<BR><BR><BR>CBRS_ALIGN_ANY Allows docking on any side of the client area.<BR><BR><BR>CBRS_FLOAT_MULTI Allows multiple control bars to be floated in a single mini-frame window.<BR>If 0 (that is, indicating no flags), the control bar will not dock.<BR><BR>Remarks<BR><BR>Call this function to enable a control bar to be docked. The sides specified must match one of the sides enabled for docking in the destination frame window, or the control bar cannot be docked to that frame window.<BR><BR>CControlBar Overview | Class Members | Hierarchy Chart<BR><BR>See Also CFrameWnd::EnableDocking, CFrameWnd::DockControlBar, CFrameWnd::FloatControlBar, CControlBar::SetBarStyle<BR><BR><BR>--------------------------------------------------------------------------------<BR>Send feedback to MSDN.Look here for MSDN Online resources.
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:徐景周 回复日期:2002-09-23 09:46:43
<br>内容:可试试下面方法,可使工具条在同一行显示。<BR>可使用下面涵数:<BR>// ---------------------------------------------------------<BR>// 名称:DockControBarLeftOf<BR>//<BR>// 功能:停靠Toolbar函数<BR>//<BR>// 变量:Bar----用于停靠的Toolbar<BR>// LeftOf----已停靠的左侧Toolbar<BR>// 返回:无<BR>//<BR>// 编写: 徐景周<BR>// 编写日期:2002.04.30<BR>// ---------------------------------------------------------<BR>void CMainFrame::DockControlBarLeftOf(CControlBar* Bar, CControlBar* LeftOf)<BR>{<BR> CRect rect;<BR> DWORD dw;<BR> UINT n;<BR> <BR> // get MFC to adjust the dimensions of all docked ToolBars<BR> // so that GetWindowRect will be accurate<BR> RecalcLayout(TRUE);<BR> <BR> LeftOf->GetWindowRect(&rect);<BR> rect.OffsetRect(1,0);<BR> dw=LeftOf->GetBarStyle();<BR> n = 0;<BR> n = (dw&CBRS_ALIGN_TOP) ? AFX_IDW_DOCKBAR_TOP : n;<BR> n = (dw&CBRS_ALIGN_BOTTOM && n==0) ? AFX_IDW_DOCKBAR_BOTTOM : n;<BR> n = (dw&CBRS_ALIGN_LEFT && n==0) ? AFX_IDW_DOCKBAR_LEFT : n;<BR> n = (dw&CBRS_ALIGN_RIGHT && n==0) ? AFX_IDW_DOCKBAR_RIGHT : n;<BR> <BR> // When we take the default parameters on rect, DockControlBar will dock<BR> // each Toolbar on a seperate line. By calculating a rectangle, we in effect<BR> // are simulating a Toolbar being dragged to that location and docked.<BR> DockControlBar(Bar,n,&rect);<BR>}<BR><BR>使用方法:<BR> DockControlBar(&m_wndToolBarMain);<BR> DockControlBarLeftOf( &m_wndToolBarOperate, &m_wndToolBarMain );<BR> DockControlBarLeftOf( &m_wndToolBarResp, &m_wndToolBarOperate );<BR> DockControlBarLeftOf( &m_wndToolBarView, &m_wndToolBarResp );
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:iwill 回复日期:2002-09-23 12:44:04
<br>内容:Docking Toolbars Side-By-Side<BR>This article was contributed by Kirk Stowell.<BR>If you are interested in more articles written by Kirk Stowell, you can click here to visit his home page.<BR><BR><BR><BR>There are several articles about docking toolbars, however, I felt that this was important enough to mention here. The same information can be found at Microsofts MSDN site, here it is in a nutshell:<BR><BR>Add the following method to your CMainFrame class:<BR><BR><BR>void CMainFrame::DockControlBarLeftOf(CToolBar* Bar, CToolBar* LeftOf)<BR>{<BR> CRect rect;<BR> DWORD dw;<BR> UINT n;<BR> <BR> // get MFC to adjust the dimensions of all docked ToolBars<BR> // so that GetWindowRect will be accurate<BR> RecalcLayout(TRUE);<BR> <BR> LeftOf->GetWindowRect(&rect);<BR> rect.OffsetRect(1,0);<BR> dw=LeftOf->GetBarStyle();<BR> n = 0;<BR> n = (dw&CBRS_ALIGN_TOP) ? AFX_IDW_DOCKBAR_TOP : n;<BR> n = (dw&CBRS_ALIGN_BOTTOM && n==0) ? AFX_IDW_DOCKBAR_BOTTOM : n;<BR> n = (dw&CBRS_ALIGN_LEFT && n==0) ? AFX_IDW_DOCKBAR_LEFT : n;<BR> n = (dw&CBRS_ALIGN_RIGHT && n==0) ? AFX_IDW_DOCKBAR_RIGHT : n;<BR> <BR> // When we take the default parameters on rect, DockControlBar will dock<BR> // each Toolbar on a seperate line. By calculating a rectangle, we<BR> // are simulating a Toolbar being dragged to that location and docked.<BR> DockControlBar(Bar,n,&rect);<BR>}<BR><BR><BR>Now, in your CMainFrame::OnCreate, instead of using DockControlBar, use DockControlBarLeftOf:<BR><BR><BR> m_wndToolBar1.EnableDocking(CBRS_ALIGN_ANY);<BR> m_wndToolBar2.EnableDocking(CBRS_ALIGN_ANY);<BR> EnableDocking(CBRS_ALIGN_ANY);<BR> DockControlBar(&m_wndToolBar1);<BR> DockControlBarLeftOf(&m_wndToolBar2,&m_wndToolBar1);<BR><BR><BR>This will dock m_wndToolBar2 left of m_wndToolBar1.<BR><BR><BR>Download demo project - (29 KB) <BR><BR>Last updated December 21, 1998<BR>Date Posted: June 23, 1998<BR><BR>以上摘自<BR>http://www.codeguru.com/toolbar/demo_toolbar_d.shtml<BR><BR>某些人 , ...
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:凯凯 回复日期:2002-09-23 12:50:40
<br>内容:?!
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -