Wie füge ich ein Icon zu System.Windows.Forms.MenuItem hinzu?
Ich habe versucht, einem meiner Kontextmenüelemente ein Symbol hinzuzufügen, konnte dies jedoch nicht tun. Kann mir jemand helfen?
Hier ist der Code, den ich geschrieben habe:
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;
}
}