Using NotifyIcon controls and ContextMenuStrip controls to implement
1. Drag the NotifyIcon control and the ContextMenuStrip control onto the form
2. formclosing event in form
Cancel closing Form E. Cancel = true;//Changes the form to minimize this. WindowState = Formwindowstate.minimized;this. ShowInTaskbar = false; Do not display in the system tray Notifyicon1.visible = true; Tray icon Visible Notifyicon1.showballoontip (10);//Show Bubbles
3. The MouseDoubleClick event in NotifyIcon1
If the form is minimized, restore if (this. WindowState = = formwindowstate.minimized) {This . Show (); This. WindowState = Formwindowstate.normal; This. ShowInTaskbar = true; }
4. Specify the ContextMenuStrip1 control in the NotifyIcon1 ContextMenuStrip property
Also note that you want to specify icon, otherwise you will not see it when zoomed out
5.contextmenustrip1 the item button to implement the Exit function
Exit this. Close (); Application.exit ();
6.notifyIcon Showballoontip property, showing bubbles
7. Specify the icon size of the NotifyIcon
Method One:
NotifyIcon. Icon=newicon("c:\\ your Icon.ico", +--);
Method Two:
The automatic code in the direct change designer.cs is This.notIco.Icon = new System.Drawing.Icon (RESRC.C, 16, 16);
RESRC is a resource file
Window minimized to pallet