Windows窗体没有得到关注

编程入门 行业动态 更新时间:2024-10-24 12:23:37
本文介绍了Windows窗体没有得到关注的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在我的应用程序中,我必须在加载主应用程序窗口之前显示一个'登录窗口'。它正确加载,但问题是 无法获得焦点。

我尝试过 TopMost = true,form.Focus(),form.Show(),form.Select(),form.Activate()以及一些pinvoke方法,例如 SetActiveWindow(handle), SetForegroundWindow(handle),SetFocus(handle) (以及他们的不同组合......)。但是没有解决我的问题。

I have triedTopMost = true, form.Focus(), form.Show(), form.Select(), form.Activate()and also some pinvoke methods such asSetActiveWindow(handle), SetForegroundWindow(handle), SetFocus(handle)(and their different combinations too..). But not solved my problem.

但是,我的登录窗口首先显示在应用程序列表上(当我们点击Alt + Tab时显示)并且焦点是获得应用程序,这是第二位。

But, my Login window is showing in first place on Application List(displaying when we hit Alt+Tab) and the focus is getting on the application, which is in second place.

任何人请帮忙......这是一个高优先级问题......

Anyone please help... Its a high priority issue...

先谢谢..

Thanks in advance..

推荐答案

可能是你不小心设置它的情况在应用程序的某个地方,所以重点放在了表单,然后快速返回到应用程序。将登录表单中的调试点添加到方法/事件中以进行聚焦,并检查是否存在,以及它是否在下一步。 Hi, It may be the case where you are accidentally setting it somewhere in application so the focus goes to the form and then quickly goes back to the application. Add a debug point in the login form to the method/event for focus and check if it comes there at all and if it does where it does next.

更多推荐

Windows窗体没有得到关注

本文发布于:2023-11-08 16:09:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1569851.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:窗体   Windows

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!