请问如何制作工具条呢?为什么这种问题都没人愿回答呢
<p>在论坛里找到很多同样的问题,都没有什么好意见啊</p> <p> 建立CAD -- NET托管程序比较容易实现,</p><p></p><p>/</p><p>using System ;<br/>using Autodesk.AutoCAD.Runtime ;<br/>using Autodesk.AutoCAD.ApplicationServices;<br/>using Autodesk.AutoCAD.Interop;<br/>using System.Runtime.InteropServices;//系统com支持<br/>using Autodesk.AutoCAD.EditorInput;<br/></p><p>namespace ClassLibrary<br/>{<br/> /// <summary><br/> /// Summary description for SLClass.<br/> /// </summary><br/> public class SLClass<br/> {<br/> public SLClass()<br/> {<br/> //<br/> // TODO: Add constructor logic here<br/> //<br/> }<br/> public void Initialize()<br/> {<br/> Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;<br/> ed.WriteMessage("SLTireCAD系统初始化中……");<br/> }</p><p> // Define Command "AsdkCmd1"<br/> <br/> static public void LoginSLTireCAD() // This method can have any name<br/> {<br/> // Put your command code here<br/> AcadApplication AcadApp;<br/> try<br/> {<br/> AcadApp = (AcadApplication) Marshal.GetActiveObject("AutoCAD.Application");<br/> }<br/> catch<br/> {<br/> AcadApp = null;<br/> }<br/> if (AcadApp!=null) <br/> {<br/> AcadPopupMenu Mymenu=AcadApp.MenuGroups.Item(0).Menus.Add("XXXXCAD");<br/> Mymenu.AddMenuItem(0,"系统登陆","_LoginXXXCAD ");<br/> Mymenu.AddMenuItem(1,"圆","_circle ");<br/> <br/> Mymenu.AddSeparator(2);</p><p> AcadPopupMenu subm=Mymenu.AddSubMenu("","子菜单");//下级菜单<br/> subm.AddMenuItem(0,"射线","Xline ");<br/> Mymenu.AddSeparator(4);<br/> <br/> Mymenu.AddMenuItem(5,"圆弧","_ARC ");<br/> Mymenu.AddMenuItem(6,"关于SLTireCAD","__AbouteSLCAD");<br/> Mymenu.InsertInMenuBar(14);//插入到当前菜单组14</p><p> <br/> AcadToolbar MyToolBar=AcadApp.MenuGroups.Item(0).Toolbars.Add("SLTireCAD工具栏");<br/> AcadToolbarItem tbBut1 = MyToolBar.AddToolbarButton(0, "系统登陆", "系统登陆", "_LoginXXCAD\n", false);<br/> <br/> //tbBut1.SetBitmaps("D:\\BMP_BTN_LOGIN.bmp","D:\\BMP_BTN_LOGIN.bmp");</p><p> AcadToolbarItem tbBut2 = MyToolBar.AddToolbarButton(2, "关于SLTireCAD", "关于XXCAD", "_AbouteXXCAD\n", false);<br/> //tbBut2.SetBitmaps("BMP_BTN_LOGIN.bmp","BMP_BTN_LOGIN.bmp");<br/> tbBut2.TagString ="关于SLTireCAD……";</p><p><br/> </p><p> //tbBut.SetBitmaps("first.bmp", "first.bmp");<br/> MyToolBar.top = 100;<br/> MyToolBar.left =100;<br/> MyToolBar.Visible = true; </p><p> } <br/> } </p><p> }<br/>}</p><p></p>
页:
[1]