首页 > Windows开发 > 详细

winform图标最小化显示在任务栏右下角

时间:2015-01-29 10:20:43      阅读:394      评论:0      收藏:0      [点我收藏+]

http://www.cnblogs.com/shenyixin/archive/2013/07/05/3173640.html

private void Form1_SizeChanged(object sender, EventArgs e)
{
    if (this.WindowState == System.Windows.Forms.FormWindowState.Minimized)
    {
        this.Hide();
        this.notifyIcon1.Visible = true;
    }
    if (this.WindowState == FormWindowState.Normal)
    {
        this.notifyIcon1.Visible = false;
    }
}
 
private void Form1_FormClosing(object sender, FormClosingEventArgs e)      
  {           
     if (e.CloseReason == CloseReason.UserClosing)//当用户点击窗体右上角X按钮或(Alt + F4)时 发生           
     {                
         e.Cancel = true;                
         this.ShowInTaskbar = false;               
         this.myIcon.Icon = this.Icon;                
         this.Hide();           
     }        
  }               
  
  private void myIcon_MouseClick(object sender, MouseEventArgs e)        
  {           
   if (e.Button == MouseButtons.Right)            
   {                
       myMenu.Show();            
   }            
   
   if (e.Button == MouseButtons.Left)           
    {                
    this.Visible = true;                
    this.WindowState = FormWindowState.Normal;                            
    }        
 }                 
 
 private void toolMenuCancel_Click(object sender, EventArgs e)         
 {             
    Application.Exit();         
 }

winform图标最小化显示在任务栏右下角

原文:http://www.cnblogs.com/csharphuang/p/4258946.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!