Window minimized to pallet

Source: Internet
Author: User

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

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.