Use policyicon to minimize the window to the taskbar Area

Source: Internet
Author: User

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 ;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.