tcsl9621 发表于 2006-4-10 20:36:00

用VB.net在CAD下动态加载菜单

public class class1 <BR>'<BR>Dim acadapp As AcadApplication = Application.AcadApplication<BR>'<BR>&lt;CommandMethod("addmenu")&gt; _<BR>public sub addmenu ()<BR>Dim mymenu As AcadPopupMenu = acadapp.MenuGroups.Item(0).Menus.Add("&amp;Mymenu")<BR>dim m1 as AcadPopupMenuItem = mymenu.AddMenuItem(0, "&amp;Line", "line ")<BR>mymenu.AddSeparator(1)<BR>dim m2 As AcadPopupMenu = mymenu.AddSubMenu(2, "&amp;Submenu")<BR>dim m3 as AcadPopupMenuItem = m2.AddMenuItem(3, "&amp;Circle", "circle ")<BR>dim m4 as AcadPopupMenuItem = m2.AddMenuItem(4, "&amp;Arc", "arc ")<BR>mymenu.InsertInMenuBar(12)<BR>end sub<BR>end class<BR>向CAD中加入自已的菜单,摸索了好多天。唉。。。。<BR>在此拿出来供大家分享。

simonkx 发表于 2006-4-23 23:36:00

不错,顶起

babyshan 发表于 2006-4-25 14:49:00

能用吗?

tcsl9621 发表于 2006-4-25 19:23:00

本帖最后由 作者 于 2006-4-26 21:55:59 编辑 <br /><br /> <P>当然能用.你可以上机试试。我在网上找了很久都没有。我只好一点一点摸索着找出来的。</P>

houlinbo 发表于 2006-5-9 11:34:00

系统菜单怎么能够动态隐藏?

tcsl9621 发表于 2006-5-11 20:07:00

<P>我没试过隐藏,不过可以试试.</P>

56854365 发表于 2006-5-15 17:02:00

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For i As Integer = 0 To app.MenuGroups.Count - 1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; app.MenuGroups.Item(i).Unload()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next</P>
<P>这样就可以把CAD自带的菜单都卸载掉了</P>

heluyuan 发表于 2006-5-17 09:39:00

<P>不错,试了一下,确实可行!</P>
<P>但在C#.net中找了很久,也没弄出来,楼主可否再赐教……</P>

tcsl9621 发表于 2006-5-19 21:37:00

C#和VB.NET中编程是一样的。我没用C#。

lhtfh 发表于 2006-5-21 13:24:00

<STRONG>不错,可以试试</STRONG>
页: [1] 2 3
查看完整版本: 用VB.net在CAD下动态加载菜单