WPF总在最前 [英] WPF Always On Top

查看:910
本文介绍了WPF总在最前的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能使一个窗口始终保持甚至当其他应用程序在运行全屏顶部?我现在使用最顶层=真但是,当其他应用程序在全屏运行的矿井变为不可见。这是 WindowStyle =顺便说一句无窗口

Is it possible to make a window stay always on top even when other application is running on Fullscreen? I'm using right now TopMost = true but when other application is running on fullscreen mine becomes invisible. It's WindowStyle = None window by the way.

修改:不要让其他窗口minimalize ofcourse

Edit: And do not let other window minimalize ofcourse

推荐答案

这是行不通的100%的时间,但它会有所改善。您可以设置朵蒙特= TRUE 中的处理程序中的 Window.Deactivated 事件:

This won't work 100% of the time, but it will improve the situation somewhat. You can set Topmost = true in the handler for the Window.Deactivated event:

private void Window_Deactivated(object sender, EventArgs e)
{
    Window window = (Window)sender;
    window.Topmost = true;
}



停用事件只要您的应用程序失去焦点(通常当其他应用程序的请求是朵蒙特),并因此这将复位后,这是你在上面的应用程序。

The Deactivated event will be called whenever your application loses focus (often when another application requests to be Topmost) and so this will reset your application on top after this.

这篇关于WPF总在最前的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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