this is a simple code which i made to get list of all menus and sub-menus of Form
Now i wanna add each name of MenuItem to TreeView to show tree-style of menu.
can anybody make it possible?
TraceToolStripItem( menuStrip1.Items );
/********************/
private void TraceToolStripItem( ToolStripItemCollection menus )
{
ToolStripMenuItem t = new ToolStripMenuItem();
foreach ( ToolStripItem c in menus )
{
if ( c is ToolStripMenuItem )
{
t = (ToolStripMenuItem) c;
// checkedListBox1.Items.Add( t.Text );
TraceToolStripItem( t.DropDownItems );
}
}
}
It is very much simple coding for getting list of menus and also sub menus of form. I also added MenuItem to TreeView to show tree style of menu. It is very much helpful for me, nice to share with us.