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;
                }
            }
        }
  • 相关阅读:
    计算页数
    DOS批量拷贝文件
    时间与日期处理
    MOUSE_OVER/MOUSE_OUT与ROLL_OVER/ROLL_OUT的区别
    vb程序改写方法。
    sqldmo备份还原sqlserver2000数据库
    终于有了自己的窝啦
    vb中创建Excel,把数据存入Excel
    提高vb 》excel数据的导入速度
    SQLServer2000数据库特有的1433端口号不能访问
  • 原文地址:https://www.cnblogs.com/KenBlove/p/1281890.html
Copyright © 2011-2022 走看看