public void RibbonDemo() { RibbonControl ribbonCtrl = ComponentManager.Ribbon; //获取cad的Ribbon界面 RibbonTab tab = ribbonCtrl.AddTab("我的测试选项卡", "Acad.RibbonId1", true); //给Ribbon界面添加一个选项卡 CurPaht.curPaht = Path.GetDirectoryName(this.GetType().Assembly.Location) + "\\"; //获取程序集的加载路径 RibbonPanelSource panelSource = tab.AddPanel("绘图"); //给选项卡添加面板 panelSource.Items.Add(RibbonButtonInfos.LineBtn); //添加直线命令按钮 panelSource.Items.Add(RibbonButtonInfos.PolylineBtn); //添加多段线命令按钮 }
public void Btn() { RibbonControl ribbonControl = ComponentManager.Ribbon; //获取CAD的Ribbon界面 RibbonTab ribbonTab = ribbonControl.AddTab("百福工具箱", "Acad.MyRibbonId1", true); //给Ribbon界面添加一个选项卡 ribbonTab.Panels.Add(ribbonControl.Tabs[0].FindPanel("ID_PanelLayers")); ribbonTab.Panels.Add(ribbonControl.Tabs[2].FindPanel("ID_PanelDimensions")); //RibbonPanelSource ribbonPanelSource0 = ribbonControl.Tabs[2].FindPanel("ID_PanelDimensions").Source; RibbonPanelSource ribbonPanelSource1 = ribbonTab.AddPanel("设置");//给选项卡添加面板 //添加**命令按钮 ribbonPanelSource1.Items.Add(RibbonButtonInfos.PSet); ribbonPanelSource1.Items.Add(RibbonButtonInfos.Hthj); RibbonPanelSource ribbonPanelSource2 = ribbonTab.AddPanel("图层工具");//给选项卡添加面板 ribbonPanelSource2.Items.Add(RibbonButtonInfos.CurLayer); RibbonPanelSource ribbonPanelSource3 = ribbonTab.AddPanel("绘图工具");//给选项卡添加面板 ribbonPanelSource3.Items.Add(RibbonButtonInfos.Szc); }