Community
I am trying to achieve the stacking button panel like the 'modify' panel in the 'Home' tab (Picture Below).
How do I achieve this with a C# plugin?
Use the RibbonPanelBreak.
using Autodesk.AutoCAD.Runtime;
using Autodesk.Windows;
namespace AutoCADTest
{
public class Class1
{
[CommandMethod("testmyRibbon", CommandFlags.Transparent)]
public void Testme()
{
RibbonControl ribbon = ComponentManager.Ribbon;
if (ribbon != null)
{
RibbonTab rtab = ribbon.FindTab("TESTME");
if (rtab != null)
{
ribbon.Tabs.Remove(rtab);
}
rtab = new RibbonTab();
rtab.Title = "TEST ME";
rtab.Id = "Testing";
//Add the Tab
ribbon.Tabs.Add(rtab);
addContent(rtab);
}
}
static void addContent(RibbonTab rtab)
{
rtab.Panels.Add(AddOnePanel());
}
static RibbonPanel AddOnePanel()
{
RibbonButton rb;
RibbonRowBreak rbrk;
RibbonPanelSource rps = new RibbonPanelSource();
rps.Title = "Test One";
RibbonPanel rp = new RibbonPanel();
rp.Source = rps;
//Create a Command Item that the Dialog Launcher can use,
// for this test it is just a place holder.
RibbonButton rci = new RibbonButton();
rci.Name = "TestCommand";
//assign the Command Item to the DialgLauncher which auto-enables
// the little button at the lower right of a Panel
rps.DialogLauncher = rci;
rb = new RibbonButton();
rb.Name = "Test Button 1";
rb.ShowText = true;
rb.Text = "Test Button 1";
//Add the Button to the Tab
rps.Items.Add(rb);
rbrk = new RibbonRowBreak();
rps.Items.Add(rbrk);
rb = new RibbonButton();
rb.Name = "Test Button 2";
rb.ShowText = true;
rb.Text = "Test Button 2";
//Add the Button to the Tab
rps.Items.Add(rb);
rbrk = new RibbonRowBreak();
rps.Items.Add(rbrk);
rb = new RibbonButton();
rb.Name = "Test Button 3";
rb.ShowText = true;
rb.Text = "Test Button 3";
//Add the Button to the Tab
rps.Items.Add(rb);
RibbonPanelBreak rpbrk = new RibbonPanelBreak();
rps.Items.Add(rpbrk);
rb = new RibbonButton();
rb.Name = "Test Button 4";
rb.ShowText = true;
rb.Text = "Test Button 4";
//Add the Button to the Tab
rps.Items.Add(rb);
return rp;
}
}
}
Can't find what you're looking for? Ask the community or share your knowledge.