在我的Web浏览器控件中启用Tab键 [英] Enable Tab Key in my Web Browser Control

查看:184
本文介绍了在我的Web浏览器控件中启用Tab键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在自定义任务窗格控件(用户控件)中有一个Web浏览器控件,一旦打开Outlook,便将它作为侧边栏打开(我已使用Visual Studio 2013将其创建为Outlook插件). Web浏览器控件中有一个登录表单,一旦Outlook打开,我想将重点放在Web浏览器控件中的输入控件上.我尝试了几种技巧,例如将焦点放在自定义用户控件上,然后在窗体加载后将焦点放在输入控件上,但没有将焦点放在该控件上.另外,我一直在尝试允许使用Tab和Delete键在Web浏览器控件中使用,以便可以像在普通浏览器窗口中那样使用Tab和其他控件进行播放.请让我知道在没有想法的情况下如何实现这一目标.

I have a web browser control in a custom task pane control (User Control) and I open it as a sidebar as soon as my Outlook opens (I have created it as an Outlook Addin using Visual Studio 2013). The web browser control has a login form inside it and I would like to place focus on an input control in my web browser control as soon as Outlook opens. I have tried several tricks like placing focus on the custom user control and then placing focus on the input control after the form has loaded but it doesn't place focus on it. Also I have been trying to allow the use of Tab and Delete keys to work inside the web browser control so that I can tab to other controls and play with it like we would do it on a normal browser window. Kindly let me know how I can achieve this as I am out of ideas.

干杯.

推荐答案

尝试使用Excel WebBrowser控件代替System.Windows.Forms WebBrowser;它处理特殊的键转发,例如TAB,DEL,CTRL + V等.

Try to use the Excel WebBrowser Control instead of the System.Windows.Forms WebBrowser; it handles special key forwarding as TAB, DEL, CTRL+V, etc.

为此,将WebBrowser构造器从更改为

For that change the WebBrowser contructor from

new System.Windows.Forms.WebBrowser();

new Microsoft.Office.Tools.Excel.Controls.WebBrowser();  

您需要添加对项目的引用: 项目/添加引荐/扩展选择 Microsoft.Tools.Outlook& Microsoft.Tools.Outlook.v4.0.Utilities

You would need to add references to your project: Project/Add Referernce/Extensions select Microsoft.Tools.Outlook & Microsoft.Tools.Outlook.v4.0.Utilities

文档: https://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.controls.webbrowser.aspx

这篇关于在我的Web浏览器控件中启用Tab键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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