bearv 发表于 2006-9-16 01:59:00

请教一个关于工具条的问题

Sub Example_AddToolbarButton()
    ' This example creates a new toolbar called TestToolbar and inserts a
    ' toolbar button into it. The toolbar is then displayed.
    ' To remove the toolbar after execution of this macro, use the Customize Menu
    ' option from the Tools menu.
   
    Dim currMenuGroup As acadMenuGroup
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)
   
    ' Create the new toolbar
    Dim newToolBar As AcadToolbar
    Set newToolBar = currMenuGroup.Toolbars.Add("TestToolbar")
   
    ' Add a button to the new toolbar
    Dim newButton As AcadToolbarItem
    Dim openMacro As String
   
    ' Assign the macro string the VB equivalent of "ESC ESC _open "
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)
   
    Set newButton = newToolBar.AddToolbarButton("", "NewButton", "Open a file.", openMacro)
   
   
    ' Display the toolbar
    newToolBar.Visible = True
   
End Sub 1:上面的代码 可以生成一个条,但是关掉生成的toolbar后 ,再运行程序就会出错,    可能是关掉的toolbar没有卸载完。怎么彻底删除toolbar?2: 生成的toolbar,上面的按钮只能实现打开、保存等功能,怎么能点击按钮后调用自己    的函数来实现其他功能?急切等待您的指点

zzhzq_1234 发表于 2006-9-18 19:56:00

那是因为已经有了toolbar了
页: [1]
查看完整版本: 请教一个关于工具条的问题