How can i get all controls in ribboncontroladv such as toolstripdropdown items,toolstrip buttons ext.....
|
# Form1.cs
private void getRibbonItems()
{
// Get the ribbon tab
foreach (ToolStripTabItem toolStriptabItem in this.wordribbon.Header.MainItems)
{
string tabHeader = toolStriptabItem.Text.ToString();
//Get the ribbon panel
RibbonPanel panel = toolStriptabItem.Panel;
if (panel != null)
{
foreach(ToolStripEx toolStripEx in panel.Controls)
{
if (toolStripEx != null)
{
foreach(object obj in toolStripEx.Items)
{
if (obj is ToolStripDropDownButton)
{
ToolStripDropDownButton toolStripDropDownButton = obj as ToolStripDropDownButton;
}
else if(obj is ToolStripButton)
{
ToolStripButton toolStripDropDownButton = obj as ToolStripButton;
}
else if(obj is ToolStripPanelItem)
{
ToolStripPanelItem toolStripDropDownButton = obj as ToolStripPanelItem;
}
else if (obj is ToolStripGallery)
{
ToolStripGallery toolStripDropDownButton = obj as ToolStripGallery;
}
}
}
}
}
}
} |
thank you so much.