日期:2014-05-17 浏览次数:21442 次
public static class ContextMenuStripHelper
{
public static event ContextMenuStripItemClickedEventHandler ItemClick;
static Dictionary<ContextMenuStrip, ContextMenuStripState> _menus;
public static void InitializeHelper(this ContextMenuStrip menu)
{
if (menu == null)
throw new ArgumentNullException("menu");
if (_menus == null)
_menus = new Dictionary<ContextMenuStrip, ContextMenuStripState>();
if (!_menus.ContainsKey(menu))
{
WireEvents(menu);
_menus.Add(menu, new ContextMenuStripState());
}
}
static void ContextMenuStrip_Disposed(object sender, EventArgs e)
{
ContextMenuStrip menu = (ContextMenuStrip)sender;