毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> net技术 >> 正文

notifyIcon_MouseClick事件中当窗体最小化WIN7不会显示到当前窗体

更新时间:2014-6-7:  来源:毕业论文
   private void notifyIcon_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            //如果鼠标左键单击
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                if (this.Visibility == Visibility.Visible)
                {
                    this.Visibility = Visibility.Hidden;
                }
                else
                {
                    this.Visibility = Visibility.Visible;                   
                    if (this.WindowState == System.Windows.WindowState.Minimized)
                    {
                        this.WindowState = System.Windows.WindowState.Normal;
 
                    }
                    //当窗体点击最小化后,只有显示托盘图标
                       //但是点击托盘后,他只是显示在任务栏
                    this.Activate();
                    //activate后还是在任务栏,而这时我想要的是他还原,原来大小并为我当前焦点 谢谢
                }
            }
        }
        /// <summary>
        /// 窗体状态改变时候触发
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SysTray_StateChanged(object sender, EventArgs e)
        {
            if (this.WindowState == WindowState.Minimized)
            {
                //这里实现最小化的时候不在任务栏中显示,而只是显示一个托盘
                this.Visibility = Visibility.Hidden;
            }
        }
去掉if (this.WindowState == System.Windows.WindowState.Minimized)
这个判断,无论如何都执行this.WindowState = System.Windows.WindowState.Normal;
  private void SysTray_StateChanged(object sender, EventArgs e)
        {
            if (this.WindowState == WindowState.Minimized)
            {
                //这里实现最小化的时候不在任务栏中显示,而只是显示一个托盘
                this.Visibility = Visibility.Hidden;
            }
            else
            {
                this.Visibility = Visibility.Visible;
            }
        }
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优尔论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。