给前面带一扇窗户 [英] Bring a window to front

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

问题描述

我有一个WPF和一个输入按钮,当我点击回车时,会打开一个新的WPF。但它落后于第一个WPF,所以我用它,



I have a WPF and an enter button on it, when i click enter, a new WPF is opened. But it is behind first WPF, so i used this,

mw2.ShowDialog();
     mw2.BringWindowToTop();
















or


mw2.ShowDialog();
     mw2.BringToFront();





但VS说不包含定义



我怎样才能把那个窗口带到前面。





谢谢。



but VS says "does not contain the definition"

How can i Bring that window to front.


Thanks.

推荐答案

对我来说问题不是如何把它带到前面,但为什么它不会自动出现在前面?



我看到一个对话框没有出现在前面的唯一情况是创建窗口是 TopMost 和对话框的所有者属性尚未设置。



设置所有者应该强制对话框前面。



Alan。
To me the question is not "How do I bring it to the front" but why did it not come to the front automatically?

The only situation in which I have seen a dialog not come to the front was when the creating window was TopMost and the dialog''s Owner property had not been set.

Setting the Owner should force the dialog to the front.

Alan.


mw2.Activate(); 将尝试将窗口置于前面并专注于它。
mw2.Activate(); will attempt to bring the window to the front and focus on it.


这篇关于给前面带一扇窗户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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