我有一个 Web 浏览器控件,它已导航到给定页面并准备就绪。现在我想在用户单击我页面上的特定按钮时调出 Internet Explorer 查找对话框。用户已经可以通过单击“ctrl+f”调出查找对话框,但我也想要一个用于此操作的单独按钮。
我发现了这个: http://support.microsoft.com/kb/329014
但是它有以下问题:
该页面指出此方法可能不适用于更高版本的 Internet Explorer:
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 命名空间。
最佳答案
我自己找到了解决办法: 如果网络浏览器控件名称为“web”,您可以使用以下代码向其发送“Crtl+f”键:
web.Focus();
SendKeys.Send("^f");
我对此进行了测试,它在 Internet Explorer 8 上弹出了查找对话框。
关于c# - 如何从 Web 浏览器控件中调出“查找”对话框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3590483/