[CommandMethod("AddPaletteSet")] public void AddPaletteSet() { //PaletteSet paletteset = new PaletteSet("我的MyPaletteSet"); //paletteset.Add("第一个工具栏", new System.Windows.Forms.Control("第一个工具栏")); //paletteset.Add("第二个工具栏", new System.Windows.Forms.Control("第二个工具栏")); //paletteset.Add("第二eee个工具栏", new System.Windows.Forms.Control("第二个工具栏")); //paletteset.Visible = true; //PaletteSet paletteset = new PaletteSet(""); //paletteset.Add("菜单条", new UserControl1()); //paletteset.Visible = true; //paletteset.Size = new System.Drawing.Size(200, 50); //paletteset.Dock = DockSides.Top; PaletteSet palSet = null; Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; try { if (palSet == null) { palSet = new Autodesk.AutoCAD.Windows.PaletteSet("我的面板集"); palSet.Style = PaletteSetStyles.ShowTabForSingle; palSet.Style = PaletteSetStyles.NameEditable; palSet.Style = PaletteSetStyles.ShowPropertiesMenu; palSet.Style = PaletteSetStyles.ShowAutoHideButton; palSet.Style = PaletteSetStyles.ShowCloseButton; palSet.Opacity = 90; palSet.MinimumSize = new System.Drawing.Size(300, 300); System.Windows.Forms.UserControl myPageCtrl = new UserControl1();//注意这里是加载自己写的用户控件 //myPageCtrl.Dock = System.Windows.Forms.DockStyle.Fill; palSet.Add("我的页面", myPageCtrl); palSet.Visible = true; } } catch { ed.WriteMessage("创建面板集错误"); } }