如何从webBrowser页面中复制所选文本? [英] How do I COPY the selected text from a webBrowser page?
本文介绍了如何从webBrowser页面中复制所选文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是一个难题(显然很简单):
如何从webBrowser页面中复制所选文本,并将其粘贴到文本文件(例如)?
直到现在我都有这个:
This is a Hard question(apparently simple):
How do I COPY the selected text from a webBrowser page, and paste it to a text file( for example)?
I have this until now:
private void webBrowser1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
//the 67 is the mousebutton no4 (I have 5 5buttons and a scrolwhell-A4Tech_X7 mouse)
//the mousebutton no4 is set to "ctrl+c" keys (Copy)
if (e.KeyValue == 67)
textBox2.Text=webBrowser1.DocumentText;
}
到目前为止,我无法从webBrowser复制文本选择.
该怎么做?
谢谢.
Until now i cant manage to copy a text selection from webBrowser.
How to do that?
Thank you.
推荐答案
你好,
您是否尝试过:
Hello,
Have you tried that:
webBrowser1.Document.ExecCommand("Copy", false, null);
textBox2.Text = Clipboard.GetText();
瓦莱里.
Valery.
这篇关于如何从webBrowser页面中复制所选文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文