• 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;
                }
            }
        }
  • 相关阅读:
    关于两次指针(struct型)传参数的问题
    git学习基础教程
    程序员恶性循环- 有感
    基于Tomcat 的WEB Project存在的安全漏洞总结
    使用Maven自动部署Java Web项目到Tomcat问题小记
    MyEclipse中Maven的配置
    mybatis处理集合、循环、数组和in查询等语句的使用
    JBOSS的启动和停止
    myeclipse越来越卡了怎么回事啊?
    linux shell 模拟post请求
  • 原文地址:https://www.cnblogs.com/KenBlove/p/1281890.html
Copyright © 2020-2023  润新知