Jak dodać ikonę do System.Windows.Forms.MenuItem?
Próbowałem dodać ikonę do jednego z moich elementów menu kontekstowego, ale nie mogłem tego zrobić. Czy ktoś może mi pomóc?
Oto kod, który napisałem:
private System.Windows.Forms.ContextMenu notifyContextMenu;
private void foo() {
if (notifyIcon == null) {
notifyIcon = new System.Windows.Forms.NotifyIcon();
}
if (notifyContextMenu == null) {
notifyContextMenu = new System.Windows.Forms.ContextMenu();
notifyContextMenu.MenuItems.Add("Exit");
// How do I add an icon to this context menu item?
}
notifyIcon.ContextMenu = notifyContextMenu;
}
}