网页浏览器粘贴 [英] WebBrowser Paste

查看:37
本文介绍了网页浏览器粘贴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 WebBrowser 控件用作我正在构建的 WinForm 应用程序中的 html 编辑器.我有一个按钮可以将一些文本粘贴到 WebBrowser 控件中,该按钮在除 1 之外的每台机器上都可以正常工作!这是按钮点击事件背后的代码:

I’m using the WebBrowser control as a html editor in a WinForm application I am building. I have a button which pastes some text into the WebBrowser control which works fine on every machine except 1! Here is the code behind the button click event:

Clipboard.SetText("Some text ...")
WebBrowser.Document.ExecCommand("paste", False, Nothing)

我已将问题追溯到第二行代码.更让我困惑的是,如果用户使用 WebBrowser 控件的标准右键单击菜单上的粘贴"选项,那么它会很好地粘贴文本.

I’ve tracked the problem down to the 2nd line of code. What confuses me even more is that if the user uses the "paste" option on the standard right click menu of the WebBrowser control then it pastes the text in fine.

有人对这里可能出现的问题有任何想法吗?

Has anyone any ideas on what could be wrong here?

推荐答案

我已经解决了这个问题 - 这似乎是 IE 的安全限制 - IE 中的安全级别需要中等(工具 > Internet 选项 > 安全> 互联网 > 中级)

I've fixed this problem - it seems to be a security restriction with IE - The security level in IE needs to be medium (Tools > Internet Options > security > Internet > Medium level)

这篇关于网页浏览器粘贴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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