CommandBars 使用教程:如何在同一行上添加一个或多个工具栏

Xtreme Command Bars最新试用版

默认情况下,添加工具栏时,该工具栏将显示在单独的行上。每个添加的工具栏将出现在前一个工具栏的下方。但是,很多时候使用代码将工具栏停靠在同一行中是非常有必要的。

在下面的图片中,您可以看到工具栏#2已停靠在工具栏#1旁边。这是使用代码完成的。

工具栏 下面的代码提供了一个帮助程序功能,该功能将使工具栏停靠在另一个工具栏的右侧,而不考虑工具栏的添加顺序。此代码将使您可以将工具栏停靠在另一个工具栏上,无论它是垂直的还是水平的。
'Parameters:'   BarToDock - ToolBar to be placed to'             - the RIGHT of another ToolBar'   BarOnLeft - ToolBar that will be on the LEFT side of BarToDock'   VerticalBar - Set to false if the toolbars are docked at the'                 top or bottom of the window (horizontal), set to'                 true if the toolbars are on the left or right of'                 the window (vertical).'sample usage:'   Dim ToolBar1 As CommandBar, ToolBar2 As CommandBar'   ..........Add controls to toolbars'   DockRightOf ToolBar2, ToolBar1, FalsePrivate Sub DockRightOf(BarToDock As CommandBar, _            BarOnLeft As CommandBar, VerticalBar As Boolean)    Dim Left As Long    Dim Top As Long    Dim Right As Long    Dim Bottom As Long    Dim LeftBar As CommandBar    Set LeftBar = BarOnLeft    CommandBars.RecalcLayout    BarOnLeft.GetWindowRect Left, Top, Right, Bottom    LeftBar.GetWindowRect Left, Top, Right, Bottom    If (VerticalBar = False) Then        CommandBars.DockToolBar BarToDock, Right, _                         (Bottom + Top) / 2, LeftBar.Position    Else        CommandBars.DockToolBar BarToDock, (Left + Right) _                                / 2, Bottom, LeftBar.Position    End IfEnd Sub

如果你对我们的产品感兴趣或者有任何疑问,欢迎咨询在线客服>>

标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2020年6月5日
下一篇 2020年6月5日

相关推荐

发表回复

登录后才能评论