如何从 Web 浏览器控件调出“查找"对话框? [英] How to bring up Find dialog from a web browser control?

查看:34
本文介绍了如何从 Web 浏览器控件调出“查找"对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Web 浏览器控件,它已导航到给定页面并准备就绪.现在我想在用户单击我页面上的特定按钮时打开 Internet Explorer 查找对话框.用户已经可以通过单击ctrl+f"来调出查找对话框,但我也想要一个单独的按钮用于此操作.

I have a web browser control which has navigated to a given page and is ready. Now I want to bring up the Internet explorer find dialogbox whenever the user clicks a specific button on my page. The user can already bring up the find dialog box by clicking 'ctrl+f', but I want a separate button for this action too.

我发现了这个:http://support.microsoft.com/kb/329014

但它有以下问题:

  1. 页面说这种方法可能不适用于更高版本的 Internet Explorer:

  1. The page says that this method might not work on later versions of Internet explorer:

警告本示例使用未记录的命令组 GUID将来可能会发生变化.虽然这个样本被测试为与 Internet Explorer 一起正常工作6 及更早版本,无法保证这些技术将继续在未来版本中成功运行.

Warning This sample uses an undocumented command-group GUID that is subject to change in the future. Although this sample was tested to work correctly with Internet Explorer 6 and earlier, there is no guarantee that these techniques will continue to work successfully in future versions.

  • 我无法编译代码.我已添加页面中描述的引用,但出现错误,提示找不到 AxSHDocVw 命名空间.

  • I cant compile the code. I have added the references described in the page but I get errors telling AxSHDocVw namespace could not be found.

    推荐答案

    我自己找到了一个解决方案:如果网页浏览器控件名称为web",则可以使用以下代码向其发送Crtl+f"键:

    I found a solution myself: If the web browser control name is "web", you can send the "Crtl+f" key to it with the following code:

    web.Focus();
    SendKeys.Send("^f");
    

    我对此进行了测试,它在 Internet Explorer 8 上显示了查找对话框.

    I tested this and it brought up the find dialog box on Internet explorer 8.

    这篇关于如何从 Web 浏览器控件调出“查找"对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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