[求助] 如何使自己创建的工具栏 在CAD重启后不需要再运行创建宏1
本帖最后由 作者 于 2008-11-24 20:22:53 编辑 <br /><br /> <p>我创建的工具栏,再CAD2007中保存不了,每次启动都要运行创建宏,请大侠,高手帮我看看问题出那里了,谢谢!</p><p></p><p><font size="5">有没有高手呀。帮帮忙啦。。。。。</font></p><p></p><p>原代码如下::</p><font color="#1111ee">Public Sub AddmyBar()<br/> Dim i As Integer<br/> Dim currMenuGroup As AcadMenuGroup<br/> Dim newToolBar As AcadToolbar<br/> Dim openMacro(10) As String<br/> Dim NewButton(10) As AcadToolbarItem<br/> Dim smallbitmapname(10) As String<br/> <br/> Dim pathS As String<br/> Dim appPath As String<br/> appPath = ThisDrawing.Application.Path<br/> pathS = "\Support\Survey\Icon\"<br/> pathS = appPath & pathS<br/>'创建自己标注工具栏<br/> Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)<br/> <br/> Set newToolBar = currMenuGroup.Toolbars.Add("都成军_专用工具栏")<br/> newToolBar.Float 300, 300, 1<br/> <br/> openMacro(0) = "-vbarun" + " " + "xzFont" + " "<br/> Set NewButton(0) = newToolBar.AddToolbarButton(newToolBar.Count + 1, "将文字角度改为 0", "将文字角度改为 0", openMacro(0))<br/> '设置第1个按钮的图标<br/> smallbitmapname(0) = pathS & "fb.bmp"<br/> NewButton(0).SetBitmaps smallbitmapname(0), smallbitmapname(0)<br/> <br/> openMacro(1) = "-vbarun" + " " + "zd" + " "<br/> Set NewButton(1) = newToolBar.AddToolbarButton(newToolBar.Count + 1, "展临时点/摘录控制点/点位坐标标注", "展临时点,摘录控制点,点位坐标标准", openMacro(1))<br/> '设置第2个按钮的图标<br/> smallbitmapname(1) = pathS & "ATA.BMP"<br/> NewButton(1).SetBitmaps smallbitmapname(1), smallbitmapname(1)<br/> <br/> openMacro(2) = "-vbarun" + " " + "dcj_modi.cs" + " "<br/> Set NewButton(2) = newToolBar.AddToolbarButton(newToolBar.Count + 1, "平面标注、修改", "平面标注、修改", openMacro(2))<br/> '设置第3个按钮的图标<br/> smallbitmapname(2) = pathS & "XXWZ.BMP"<br/> NewButton(2).SetBitmaps smallbitmapname(2), smallbitmapname(2)<br/> <br/> openMacro(3) = "-vbarun" + " " + "Survey.DimDrawing.SetTextStyle" + " "<br/> Set NewButton(3) = newToolBar.AddToolbarButton(newToolBar.Count + 1, "更换文本字体", "更换文本字体", openMacro(3))<br/> '设置第1个按钮的图标<br/> smallbitmapname(3) = pathS & "TextStyle.bmp"<br/> NewButton(3).SetBitmaps smallbitmapname(3), smallbitmapname(3)<br/> <br/> openMacro(4) = "-vbarun" + " " + "swline" + " "<br/> Set NewButton(4) = newToolBar.AddToolbarButton(newToolBar.Count + 1, "绘制3DLINE", "绘制三维线,以确保管道实长", openMacro(4))<br/> '设置第1个按钮的图标<br/> smallbitmapname(4) = pathS & "XYZ_LINE.bmp"<br/> NewButton(4).SetBitmaps smallbitmapname(4), smallbitmapname(0)<br/> <br/> openMacro(5) = "-vbarun" + " " + "ljfft" + " "<br/> Set NewButton(5) = newToolBar.AddToolbarButton(newToolBar.Count + 1, "拼接分幅图.", "拼接分幅图.", openMacro(5))<br/> '设置第1个按钮的图标<br/> smallbitmapname(5) = pathS & "ljfft.bmp"<br/> NewButton(5).SetBitmaps smallbitmapname(5), smallbitmapname(5)<br/> <br/> openMacro(6) = "-vbarun" + " " + "lcjs" + " "<br/> Set NewButton(6) = newToolBar.AddToolbarButton(newToolBar.Count + 1, "计算里程.", "计算里程.", openMacro(6))<br/> '设置第1个按钮的图标<br/> smallbitmapname(6) = pathS & "lcjs.bmp"<br/> NewButton(6).SetBitmaps smallbitmapname(6), smallbitmapname(6)<br/> <br/> openMacro(7) = "-vbarun" + " " + "bgxd" + " "<br/> Set NewButton(7) = newToolBar.AddToolbarButton(newToolBar.Count + 1, "管线点变大变小.", "管线点变大变小.", openMacro(7))<br/> '设置第1个按钮的图标<br/> smallbitmapname(7) = pathS & "sgxd.bmp"<br/> NewButton(7).SetBitmaps smallbitmapname(7), smallbitmapname(7)<br/> currMenuGroup.Save acMenuFileSource</font> <p>一般不建议在程序中创建菜单或工具栏,除非你的东西是动态的。</p><p>建议直接使用菜单文件建立这些东西。</p><p>一般程序建立的工具栏或菜单,只能当前进程有效,关了再开就没了。要重新再来。就象你运行程序道理是一样。</p> 那在CAD2004中是可以的呀。 <p>好象从2006版本后,菜单系统就有了变化,使用了配置方式,确实麻烦了许多。</p>
页:
[1]