如何追踪vb.net形式的迷失焦点? [英] How to Trace Lost Focus of vb.net form?

查看:64
本文介绍了如何追踪vb.net形式的迷失焦点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想知道当vb.net形式失去它的焦点时会发生什么事件?我正在使用Krypton Navigator。



我使用以下代码来显示表单。

private sub showForm(byval pform as form

Hi,

I want to know Which event fires when vb.net form lost it''s focus? I am using Krypton Navigator.

I am using the following code to show a form.
private sub showForm(byval pform as form

Dim kryPage As New KryptonPage

Me.kryNavi.Pages.Add(kryPage)

With pform

.TopLevel = False

.Parent = kryPage

.Dock = DockStyle.Fill

.BringToFront()

.Show()

.Activate()

End With

end sub





我使用上面的代码来显示表格。



回复引用

推荐答案

这个问题确实可以混乱。形式上,表单具有与焦点相关的属性,但与控件的方式完全不同。



焦点总是意味着键盘焦点,它是功能性的可聚焦的控制,而不是形式。表单被激活或停用,当它被激活时,焦点将转移到之前被聚焦的控件上。



因此,您可以处理事件时每个控件都是集中的,或者,你需要处理事件 System.Windows.Forms.Form.Activated System.Windows.Forms.Form .Deactiveate 。请参阅:

http:// msdn .microsoft.com / zh-cn / library / system.windows.forms.form.activated.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/system.windows.forms.form.deactivate.aspx [ ^ ]。



-SA
This issue can really be confusing. Formally, the form has focus-related properties, but in a very different way than controls.

The "focus" always means keyboard focus, and it is something functional for focusable controls, not forms. A form is activated or deactivated, and when it is activated, the focus goes to the control which was focused before is any.

So, you can handle the events when each control is focused, or, you rather need to handle the event System.Windows.Forms.Form.Activated or System.Windows.Forms.Form.Deactiveate. Please see:
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.activated.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.deactivate.aspx[^].

—SA


这篇关于如何追踪vb.net形式的迷失焦点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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