翻譯|使用教程|編輯:鮑佳佳|2020-07-08 17:29:41.833|閱讀 913 次
概述:本文將介紹如何使用CommandBars 在同一行上添加一個或多個工具欄附代碼教程
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
Codejock 公司的Xtreme Command Bars 提供非常漂亮的Office風格的命令條和One Note樣式的Tab. 這種構架完全支持菜單和工具欄的個性化設置, 它將在應用程序工作臺上給你更大的控制權, Xtreme Command Bars 提供嵌入式主題支持,允許你選擇預先定義的主題如Officexp、Office 2003、 Visual Studio .NET,或者自定義主題。本文主要介紹如何使用CommandBars控件操作多個工具欄。
默認情況下,添加工具欄時,該工具欄將顯示在單獨的行上。每個添加的工具欄將出現在前一個工具欄的下方。但是,很多時候使用代碼將工具欄停靠在同一行中是非常有必要的。
在下面的圖片中,您可以看到工具欄#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, False Private 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 If End Sub
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn