动态加载菜单
public System.Windows.Forms.ContextMenu CreateMenu(string strMenu,System.EventHandler menuItem_Click)
{
System.Windows.Forms.ContextMenu m_ContextMenu=new ContextMenu() ;
System.Collections.IList m_MenuAL=new ArrayList();
string[] menuListDisplay=strMenu.Split(new char[]{'|'});
foreach(string menuLab in menuListDisplay)
{
m_MenuAL.Add(new MenuItem(menuLab));
}
foreach(MenuItem menu in m_MenuAL)
{
m_ContextMenu.MenuItems.Add(menu);
menu.Click+=new System.EventHandler(menuItem_Click);
}
return m_ContextMenu;
}
{
System.Windows.Forms.ContextMenu m_ContextMenu=new ContextMenu() ;
System.Collections.IList m_MenuAL=new ArrayList();
string[] menuListDisplay=strMenu.Split(new char[]{'|'});
foreach(string menuLab in menuListDisplay)
{
m_MenuAL.Add(new MenuItem(menuLab));
}
foreach(MenuItem menu in m_MenuAL)
{
m_ContextMenu.MenuItems.Add(menu);
menu.Click+=new System.EventHandler(menuItem_Click);
}
return m_ContextMenu;
}