内容简介:翻译自:https://stackoverflow.com/questions/4609836/window-focus-problem-with-net-4-0-and-windowsformsthost
我遇到了一些我遇到麻烦的奇怪行为:
>添加一个简单的Forms控件
文本框到WindowsFormsHost;
>添加一个打开另一个按钮
WPF窗口(不设置所有者);
>最大化原始WPF窗口
然后单击文本框以使其具有
焦点;
>当你这样做然后尝试
激活其他WPF窗口
它被激活的任务栏
然后停用.
令人不安的是,如果我在.NET 3.5下编译它,它没有问题.
有任何想法吗?
在派生窗口上实现它有点帮助 – 但不能完全解决问题:
protected override void OnDeactivated(EventArgs e)
{
var host = System.Windows.Input.FocusManager.GetFocusedElement(this) as System.Windows.Forms.Integration.WindowsFormsHost;
if (host !=null )
{
Focus();
}
base.OnDeactivated(e);
}
它在停用时将焦点设置到窗口 – 这还不够早,因此激活会翻转,但是当你第二次使用alt-tab切换时.但是没有保留聚焦控制.我尝试调度焦点集 – 但没有好处.
翻译自:https://stackoverflow.com/questions/4609836/window-focus-problem-with-net-4-0-and-windowsformsthost
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- acme.sh 续期问题(路径问题)
- 缓存的一些问题和一些加密算法【缓存问题】
- 如何把设计问题转化为数学问题(方法论)
- 推荐系统中的冷启动问题和探索利用问题
- GraphQL 教程(六)—— N+1问题和缓存等问题
- Golang 并发问题(四)之单核上的并发问题
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Hit Refresh
Satya Nadella、Greg Shaw / HarperBusiness / 2017-9-26 / USD 20.37
Hit Refresh is about individual change, about the transformation happening inside of Microsoft and the technology that will soon impact all of our lives—the arrival of the most exciting and disruptive......一起来看看 《Hit Refresh》 这本书的介绍吧!