C # System Tray Program

Source: Internet
Author: User

C # Hide the window appllication as the taskbar icon when writing the minimal code.
1. Set the winform attribute showintask to false.

2. Add the policyicon control policyicon1 to add an icon for the property icon of the control policyicon1.

3. Add a form minimization event (you must first add an event reference ):

This. sizechanged + = new system. eventhandler (this. form1_sizechanged );

// The above line is the reference to be added in the main form initializecomponent () method

Private void form1_sizechanged (Object sender, eventargs E)
{
If (this. windowstate = formwindowstate. Minimized)
{
This. Hide ();
This. policyicon1.visible = true;
}

}
4. Add a click icon event (you must first add an event reference ):

Private void policyicon#click (Object sender, eventargs E)
{
This. Visible = true;

This. windowstate = formwindowstate. normal;

This. policyicon1.visible = false;
}
 

From:

Http://www.blogchinese.com/user1/38506/archives/2006/200672310146.shtml

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.