winform最小化后隐藏到右下角,单击或双击后恢复 .

01.//先拖一个notifyIcon控件进来   
02.  
03.//然后在您的notifyIcon控件中添加 MouseDoubleClick事件,代码如下   
04.  
05. private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)  
06.{  
07.this.notifyIcon1.Visible = false;  
08.base.ShowInTaskbar = true;  
09.this.Activate();  
10.this.Show();  
11.base.WindowState = FromWindowState.Normal;  
12.}  
13.// 像窗体 SizeChanged添加事件,代码如下:   
14.private void Form1_SizeChanged(object sender , EventArgs e)  
15.{  
16.  if(this.WindowState == WindowState.Minimized)  
17.{  
18.               this.notifyIcon1.Visible = true;  
19.                base.ShowInTaskbar = false;  
20.                base.Hide();  
21.}  
22.}  

 

posted @ 2013-10-23 16:49  咸鱼公子  Views(1489)  Comments(0Edit  收藏  举报