在无边框最大化应用程序隐藏任务栏后面在Win 7和Win 8 [英] Borderless application on maximize is hiding behind the task bar in Win 7 and Win 8

查看:275
本文介绍了在无边框最大化应用程序隐藏任务栏后面在Win 7和Win 8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个WPF国界的窗口。我写了一个事件来最大化窗口,但最大化,窗口的一部分,有时隐藏背后的任务栏和片刻后出现在任务栏上。

I have created a borderless window in WPF. I have written a event to maximize the window but on maximizing, part of the window sometimes hides behind the task bar and after a moment appears on top of the task bar.

我怎样才能确保窗口每次保持在任务栏的顶部?以下是我已经实现方式:

How can I ensure that the window remains on top of task bar every time ? Following is the way I have implemented:

private void OnMaximizedClicked(object sender, RoutedEventArgs e)
{
    this.WindowState = this.WindowState != WindowState.Normal ? WindowState.Normal : WindowState.Maximized;
}



我已经尝试设置TopMost属性为true,但没有帮助我无论是。

I have tried setting the TopMost property to true, but didn't help me either.

推荐答案

这将修复它,但我觉得应该有一个更优雅的方式:

This will fix it, but I feel there should be a more elegant way:

this.WindowStyle = System.Windows.WindowStyle.SingleBorderWindow;
this.WindowState = this.WindowState != WindowState.Normal 
                 ? WindowState.Normal : WindowState.Maximized;
this.WindowStyle = System.Windows.WindowStyle.None;



顺便说一句,我适应从这个的的WinForms回答。所以它不是WPF相关的,你可以抛出一个更广泛的搜索网。

Btw, I adapted it from this WinForms answer. So it's not WPF related and you can throw a wider search net.

这篇关于在无边框最大化应用程序隐藏任务栏后面在Win 7和Win 8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆