当前位置:编程学习 > C#/ASP.NET >>

C#窗体最小化到状态栏

C# 窗体最小化到状态栏 双击正常显示窗体 (contextMenustrip 设置右键菜单)
首先在窗体中添加一个 notifyIcon1控件
 
[csharp]
//最小化时 
  private void Form1_SizeChanged(object sender, EventArgs e) 
        { 
              
            if (this.WindowState == FormWindowState.Minimized) 
            { 
                this.notifyIcon1.Visible = true; 
                this.Visible = false; 
            } 
        } 

[csharp]
//鼠标双击任务栏图标显示程序界面: 
  
            private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e) 
             { 
                 if (this.Visible == false) 
                     this.Visible = true; 
             }  

 

 

摘自 欧阳小燕

补充:软件开发 , C# ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,