zoukankan      html  css  js  c++  java
  • winform如何最小化成托盘图标

        public partial class MainForm : Form
        {
            FormWindowState fws 
    = FormWindowState.Normal;

            
    public MainForm()
            {
                InitializeComponent();
                
    this.SizeChanged += new EventHandler(MainForm_SizeChanged);
                
    this.notifyIcon1.DoubleClick += new EventHandler(notifyIcon1_DoubleClick);
                
    this.notifyIcon1.Icon = new Icon("Virgo.ico");
                
    this.notifyIcon1.Visible = false;
            }

            
    void MainForm_SizeChanged(object sender, EventArgs e)
            {
                
    if (this.WindowState == FormWindowState.Minimized)
                {
                    
    this.ShowInTaskbar = false;
                    
    this.notifyIcon1.Visible = true;
                }
                
    else
                {
                    fws 
    = this.WindowState;
                }
            }

            
    void notifyIcon1_DoubleClick(object sender, EventArgs e)
            {
                
    if (this.WindowState == FormWindowState.Minimized)
                {
                    
    this.ShowInTaskbar = true;
                    
    this.notifyIcon1.Visible = false;
                    
    this.WindowState = fws;
                }
            }
        }
  • 相关阅读:
    ubuntu 16.04 安装 python selenium
    DNS 小问题
    Ubuntu下安装setuptools
    ubuntu16.04LTS更换阿里源
    Ubuntu下安装 Phantomjs
    root和user切换
    Navicat破解安装教程
    urllib2
    MySQL划重点-查询-聚合-分组
    vi编辑器
  • 原文地址:https://www.cnblogs.com/KenBlove/p/1281890.html
Copyright © 2011-2022 走看看