在我的应用程序中,我必须在加载主应用程序窗口之前显示一个'登录窗口'。它正确加载,但问题是 无法获得焦点。
我尝试过 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窗体没有得到关注
发布评论