By Adam Nagy
You can use the RibbonGallery control to achieve that:
using System; using Autodesk.AutoCAD.Runtime; using Autodesk.Windows; [assembly:CommandClass(typeof(TestProject.Commands))] namespace TestProject { public class Commands { [CommandMethod("CreateMyGallery")] public void CreateMyGallery() { RibbonControl ribbon = ComponentManager.Ribbon; RibbonTab tab = new RibbonTab(); tab.Name = "MyTab"; tab.Title = "My Tab"; tab.Id = "MyTabId"; ribbon.Tabs.Add(tab); RibbonPanelSource panelSrc = new RibbonPanelSource(); panelSrc.Name = "MyPanel"; panelSrc.Title = "My Panel"; panelSrc.Id = "MyPanelId"; RibbonGallery gallery = new RibbonGallery(); gallery.Name = "MyGallery"; gallery.Id = "MyGalleryId"; RibbonButton button1 = new RibbonButton(); button1.Name = "MyButton"; button1.Text = "My Button"; button1.Id = "MyButtonId"; gallery.Items.Add(button1); RibbonButton button2 = new RibbonButton(); button2.Name = "MyOtherButton"; button2.Text = "My Other Button"; button2.Id = "MyOtherButtonId"; gallery.Items.Add(button2); gallery.DisplayMode = GalleryDisplayMode.ComboBox; panelSrc.Items.Add(gallery); RibbonPanel panel = new RibbonPanel(); panel.Source = panelSrc; tab.Panels.Add(panel); } } }

Leave a Reply to Adam NagyCancel reply