zoukankan      html  css  js  c++  java
  • notifyIcon控件最小化图标

     private void frmMain_Load(object sender, EventArgs e)
            {
                //最小化到托盘
                this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
                notifyIcon1.Icon = new Icon("Main.ico");
                notifyIcon1.Visible = false;
                notifyIcon1.ContextMenuStrip = this.contextMenuStrip1;
                notifyIcon1.DoubleClick += new EventHandler(notifyIcon1_DoubleClick);

           }

      /// <summary>
            /// 最小化到托盘
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            private void frmMain_Resize(object sender, EventArgs e)
            {
                if (this.WindowState == FormWindowState.Minimized)
                {
                    notifyIcon1.Visible = true;
                    this.ShowInTaskbar = false;
                }
            }
            void notifyIcon1_DoubleClick(object sender, EventArgs e)
            {
                if (this.WindowState == FormWindowState.Minimized)
                {
                    this.WindowState = FormWindowState.Maximized;
                    this.Activate();
                    this.notifyIcon1.Visible = false;
                    this.ShowInTaskbar = true;
                }
            }

  • 相关阅读:
    Java第一课
    bootstrap之google fonts
    bootstrap之clearfix
    Leetcode题解
    python图片爬虫
    [python / selenium]
    使用python
    python
    python
    python爬虫入门新手向实战
  • 原文地址:https://www.cnblogs.com/Iyce/p/2738662.html
Copyright © 2011-2022 走看看