The policyicon control is used. Remember to set the form showintaskbar to true/false. It is mainly used to control whether the form is displayed on the taskbar. Remember to set an image for the icon.
CodeAs follows:
1 // Form minimization event
2 Private Void Pbminisize_click ( Object Sender, system. eventargs E)
3 {
4 // Set the windowstate to normal if the form is minimized.
5 Windowstate = Formwindowstate. minimized;
6 // Indicates whether to display the form in the Windows taskbar
7 This . Showintaskbar = False ;
8 Policyicon1.visible = True ;
9 }
10 # Endregion
11
12 // Double-click event in the taskbar Area
13 Private Void Notifyicon1_doubleclick ( Object Sender, eventargs E)
14 {
15 // Show the form when the user double clicks on the specified y icon.
16 If ( This . Windowstate = Formwindowstate. Minimized)
17 This . Windowstate = Formwindowstate. normal;
18 This . Activate ();
19 This . Showintaskbar = True ;
20 This . Policyicon1.visible = False ;
21 }
Use menuitem to set the click menu in the taskbar area. // Exit
Private Void Menuitem1_click ( Object Sender, eventargs E)
{
This . Close ();
}
// Open
Private Void Menuitem2_click ( Object Sender, system. eventargs E)
{
This . Windowstate = Formwindowstate. normal;
This . Activate ();
This . Showintaskbar = True ;
This . Policyicon1.visible = False ;
}