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;属性 可能会出现点小问题

  • 相关阅读:
    C++ 实现B+树
    SSM项目--
    spring+mybatis使用MapperScannerConfigurer简化配置
    SpringMVC复习总结
    MyBatis复习总结
    ajax
    几种常用页面的跳转
    MyShop-不用框架的基础javaweb项目
    jsp
    Guava 工具类之joiner的使用
  • 原文地址:https://www.cnblogs.com/Iyce/p/2920139.html
Copyright © 2011-2022 走看看