' Command: addtoolbar
' Creates a new toolbar called "New Toolbar", and adds it to all workspaces.
' This toolbar contains a Toolbar control for named view, button for drawing
' a pline, and a flyout that uses the "Draw" tool bar.
<CommandMethod("addtoolbar")> _
Public Sub addToolbar()
Dim newTb As New Toolbar("MyToolbar", cs.MenuGroup)
'
' *
' *
' *
' 0,0 +---------------------------+
' |
' |
' |
' | AutoCAD Screen
' |
' |
' |
' | +
' | |
' | |
' + +-----2000,1000
' *
' *
' *
' *
' *
' *
'
newTb.XCoordinate = 200
newTb.YCoordinate = 200
newTb.Rows = 1
newTb.ToolbarOrient = ToolbarOrient.floating
newTb.ToolbarVisible = ToolbarVisible.show
Dim tbBtn As New ToolbarButton(newTb, -1)
tbBtn.Name = "PolyLine"
tbBtn.MacroID = "ID_Pline"
'ToolbarControl tbCtrl = new ToolbarControl(ControlType.NamedViewControl,newTb,-1);
' ToolbarFlyout tbFlyout = new ToolbarFlyout(newTb, -1);
' tbFlyout.ToolbarReference = "DRAW";
'Make toolbar available in all workspaces
For Each wk As Workspace In cs.Workspaces
Dim wkTb As New WorkspaceToolbar(wk, newTb)
wk.WorkspaceToolbars.Add(wkTb)
wkTb.Display = 1
Next
cs.SetIsModified()
cs.Save()
' Here we unload and reload the main CUI file so the changes to the CUI file could take effect immediately.
Dim flName As String = cs.CUIFileBaseName
Application.SetSystemVariable("FILEDIA", 0)
Application.DocumentManager.MdiActiveDocument.SendStringToExecute("cuiunload " + flName + " ", False, False, False)
Application.DocumentManager.MdiActiveDocument.SendStringToExecute("cuiload " + flName + " filedia 1 ", False, False, False)
End Sub
' Creates a new toolbar called "New Toolbar", and adds it to all workspaces.
' This toolbar contains a Toolbar control for named view, button for drawing
' a pline, and a flyout that uses the "Draw" tool bar.
<CommandMethod("addtoolbar")> _
Public Sub addToolbar()
Dim newTb As New Toolbar("MyToolbar", cs.MenuGroup)
'
' *
' *
' *
' 0,0 +---------------------------+
' |
' |
' |
' | AutoCAD Screen
' |
' |
' |
' | +
' | |
' | |
' + +-----2000,1000
' *
' *
' *
' *
' *
' *
'
newTb.XCoordinate = 200
newTb.YCoordinate = 200
newTb.Rows = 1
newTb.ToolbarOrient = ToolbarOrient.floating
newTb.ToolbarVisible = ToolbarVisible.show
Dim tbBtn As New ToolbarButton(newTb, -1)
tbBtn.Name = "PolyLine"
tbBtn.MacroID = "ID_Pline"
'ToolbarControl tbCtrl = new ToolbarControl(ControlType.NamedViewControl,newTb,-1);
' ToolbarFlyout tbFlyout = new ToolbarFlyout(newTb, -1);
' tbFlyout.ToolbarReference = "DRAW";
'Make toolbar available in all workspaces
For Each wk As Workspace In cs.Workspaces
Dim wkTb As New WorkspaceToolbar(wk, newTb)
wk.WorkspaceToolbars.Add(wkTb)
wkTb.Display = 1
Next
cs.SetIsModified()
cs.Save()
' Here we unload and reload the main CUI file so the changes to the CUI file could take effect immediately.
Dim flName As String = cs.CUIFileBaseName
Application.SetSystemVariable("FILEDIA", 0)
Application.DocumentManager.MdiActiveDocument.SendStringToExecute("cuiunload " + flName + " ", False, False, False)
Application.DocumentManager.MdiActiveDocument.SendStringToExecute("cuiload " + flName + " filedia 1 ", False, False, False)
End Sub
弹出子工具条:
Dim tbFlyout As New ToolbarFlyout(acToolBar(0), -1)
tbFlyout.ToolbarReference = acToolBar(1).Name
还可参考
https://www.cnblogs.com/top5/archive/2009/12/29/1635039.html
[本日志由 tiancao1001 于 2018-09-16 11:41 PM 编辑]
|
暂时没有评论
发表评论 - 不要忘了输入验证码哦! |