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

  • 相关阅读:
    C的联合体和结构体区别
    1_大端模式和小端模式
    1_2017年中兴机试题
    树1---基础
    栈的应用2---后缀表达式
    2 链式存储栈
    2- 栈和队列----之栈
    2) 线性链表
    kaike的FLAGs
    QAQ来自弱鸡的嘲笑
  • 原文地址:https://www.cnblogs.com/Iyce/p/2738662.html
Copyright © 2011-2022 走看看