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;
                }
            }
        }
  • 相关阅读:
    (打包报错)AS打包报错:Generate Signed APK: Errors while building APK. You can find the errors in the 'Messages' view.
    NABCD
    石家庄地铁站项目最终总结报告
    团队冲刺2.7
    团队冲刺2.6
    团队冲刺2.5
    团队冲刺2.4
    团队冲刺2.3
    用户体验评价——win10自带微软拼音输入法
    团队冲刺2.2
  • 原文地址:https://www.cnblogs.com/KenBlove/p/1281890.html
Copyright © 2011-2022 走看看