以编程方式在网页浏览器控件中按 Tab 键 C#
我想以编程方式按 Tab 键。我使用了这段代码:
private void BrowserPage_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
webBrowser.Select();
webBrowser.Focus();
PreviewKeyDownEventArgs ee = new PreviewKeyDownEventArgs(Keys.Tab);
webBrowser_PreviewKeyDown(sen, ee);
}
但在网络浏览器中,焦点没有移动到下一个控件。
I want to press tab key programmatically. I used this code:
private void BrowserPage_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
webBrowser.Select();
webBrowser.Focus();
PreviewKeyDownEventArgs ee = new PreviewKeyDownEventArgs(Keys.Tab);
webBrowser_PreviewKeyDown(sen, ee);
}
but in web browser the focus is not moving to next control..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
确保 webBrowser 控件具有焦点并尝试下一行:
更多信息 此处和此处。
我希望它有帮助。
Ensure webBrowser control has the focus and try the next line:
More info here and here.
I hope it helps.
那么,当按下 Tab 键时,您想将焦点集中到网络浏览器上吗?
将您的代码放入
我认为keys.Tab应该可以工作,如果不行尝试谷歌搜索tab键的数值是什么并将其代替keys.Tab
我放置的“正在按下哪个选项卡您将运行按键在那...不是网络浏览器
希望这有帮助抱歉,如果我不正确,我只花了 7 个小时在我自己的应用程序上
更新: 选项卡的数值是 9
So when the tab key is pressed you'd like to give focus to the web browser?
put your code in
I think keys.Tab should work if not try googling what the numeric value of the tab key is and put it in place of keys.Tab
where i put " what tab is being press on you'd run the key press on that...not the webBrowser
hope this helps sorry if my not correct i just spend 7 hours on an application of my own
Update: numeric value for tab is 9