帮助!我:如何将焦点转移到以前的控件vb.net [英] Help! Me : how to transfer focus to the previous control vb.net

查看:114
本文介绍了帮助!我:如何将焦点转移到以前的控件vb.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好:

谁能帮助我解决这个问题,我的问题是如何将焦点转移到先前的控件上.

Hi all:

who can help me solve this issue, my issue is how to transfer focus to the previous control

推荐答案

对于System.Windows.Forms.Control,请使用方法GetNextControl.对于获得的控件,请调用Focus.请参阅:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.getnextcontrol.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.focus.aspx [ ^ ].

如果我回答了错误的问题,请不要怪我.在这种情况下,这是您的问题:您没有标记要使用的应用程序类型或UI库:WPF?形式?银光? ASP.NET?什么?

下次,请始终在您的问题中标记此类内容.此外,您可以早在MSDN中找到答案,然后提出此问题并等待答案.



对于WPF,您可以以几乎相同的方式使用System.Windows.FrameworkElement.PredictFocus.请参阅:
http://msdn.microsoft.com/en-us/library/system. windows.frameworkelement.predictfocus.aspx [ ^ ].

—SA
For System.Windows.Forms.Control, use the method GetNextControl. For the obtained control, call Focus. Please see:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.getnextcontrol.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.focus.aspx[^].

Don''t blame me if I answered a wrong question. In this case, this is your problem: you did not tag what application type or UI library do you use: WPF? Forms? Silverlight? ASP.NET? What?

Next time, always tag such thing in your question. Moreover, you could find the answer in MSDN much sooner then asking this question and waiting for the answer.



For WPF, you can use System.Windows.FrameworkElement.PredictFocus in nearly the same way. Please see:
http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.predictfocus.aspx[^].

—SA


嗨 您可以将书签变量定义为control
并在失去焦点的情况下将每个控件都设置为该控件
hi you can define a bookmark variable as control
and in lostfocus event of every control set it to that control
    Dim Bkm, bkm1 As Control
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
'focus to previous control
        bkm1.Focus()
    End Sub
    Private Sub TextBox3_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox3.LostFocus
        bkm1 = Bkm
        Bkm = TextBox3
    End Sub
    Private Sub TextBox4_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox4.LostFocus
        bkm1 = Bkm
        Bkm = TextBox4
    End Sub
    Private Sub TextBox5_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox5.LostFocus
        bkm1 = Bkm
        Bkm = TextBox5
    End Sub
    Private Sub TextBox1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.LostFocus
        bkm1 = Bkm
        Bkm = TextBox1
    End Sub
    Private Sub TextBox2_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.LostFocus
        bkm1 = Bkm
        Bkm = TextBox2
    End Sub


当您需要集中上一个控件时,请按一下按钮3
祝你好运


when you need to focus the previous control press button3
good luck


这篇关于帮助!我:如何将焦点转移到以前的控件vb.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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