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;
                }
            }
        }
  • 相关阅读:
    让你的网站(MAXCMS4_0)按地区、年份、语言生成分页面(已经修正)
    IPTV
    超简单,MAX普通版改为资源版方法
    Jmter操作数据库
    JMter中添加断点和关联
    jmeter返回报文乱码问题
    Jmter安装和配置
    JMter压力测试
    今天注册了
    不能登陆后删除Cookies解决
  • 原文地址:https://www.cnblogs.com/KenBlove/p/1281890.html
Copyright © 2011-2022 走看看