zoukankan      html  css  js  c++  java
  • weifenluo与notifyIcon小细节

     private void frmMain_Resize(object sender, EventArgs e)
            {
                if (this.WindowState == FormWindowState.Minimized)
                {
    
                    notifyIcon1.ShowBalloonTip(3000, "程序最小化提示",
                        "图标已经缩小到托盘,打开窗口请双击图标即可。",
                        ToolTipIcon.Info);
                    this.Hide();
                }
            }
            void notifyIcon1_DoubleClick(object sender, EventArgs e)
            {
                if (this.WindowState == FormWindowState.Minimized)
                {
                    this.WindowState = FormWindowState.Maximized;
                    this.StartPosition = FormStartPosition.CenterScreen;
                    this.Show();
                    this.BringToFront();
                    this.Activate();
                    this.Focus();
                }
                else
                {
                    this.WindowState = FormWindowState.Minimized;
                    this.Hide();
                }
            }
     private void frmMain_Load(object sender, EventArgs e)
            {
                this.dockPanel1.DocumentStyle = DocumentStyle.DockingMdi;
                //最小化到托盘
                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);
                this.SizeChanged += new System.EventHandler(this.frmMain_Resize);
                notifyIcon1.Visible = true;
                //this.ShowInTaskbar = false;
                user = HelpClass.UserManagerLogin;
                //this.tabShow.DoubleClick+=new EventHandler(tabShow_DoubleClick);
            }


    不建议使用   this.ShowInTaskbar = false;属性 可能会出现点小问题

  • 相关阅读:
    50个C/C++经典面试题
    多继承的构造顺序
    sizeof(struct)
    c++ 实现strcpy(),strlen()
    十天冲刺-01
    学习进度条(第八周)
    梦断代码阅读笔记01
    学习进度条(第七周)
    团队作业记账本开发NABCD
    学习进度条(第六周)
  • 原文地址:https://www.cnblogs.com/Iyce/p/2920139.html
Copyright © 2011-2022 走看看