2013-05-08 67 views
-1

我想在系統托盤圖標上的上下文菜單項之間添加分隔線。這是我的代碼:將分隔線添加到托盤圖標上的上下文菜單

ContextMenu cm = new ContextMenu(); 
    cm.MenuItems.Add("Resume", new EventHandler(MenuResume_Click)); 
    cm.MenuItems.Add(); // Here i want the divider 
    cm.MenuItems.Add("Logout", new EventHandler(BTNExit_Click)); 
    cm.MenuItems.Add("Logout and Quit", new EventHandler(BTNExit_Compl)); 

    this.Hide(); 
    NIControlPanel.Visible = true; 
    NIControlPanel.ContextMenu = cm; 

分頻器喜歡的是這個>>http://i.stack.imgur.com/pgksW.png

+1

請參閱http://stackoverflow.com/questions/1349856/how-do-you-add-a-separator-to-a-winforms-menu-in-c – bengoesboom 2013-05-08 20:44:52

回答

1

cm.MenuItems.Add(新ToolStripSeparator());應該可以工作

相關問題