I have picturebox and webbrowser control. in webbrowser control I'm displaying page with image. This image is visible. I can't pass to picture box url of this image because it will not display. This image is not visible if you enter it's page directy from address bar.
我有picturebox和webbrowser控件。在webbrowser控件中我正在显示带有图像的页面。此图像可见。我无法传递到此图片的图片框网址,因为它无法显示。如果您从地址栏直接输入页面,则此图像不可见。
Is there any way to get that image from browser cache or any other way?
有没有办法从浏览器缓存或任何其他方式获取该图像?
I want to get captcha image that appears on this page after viewing one add.
我希望在查看一个添加后获取此页面上显示的验证码图像。
http://www.clix-cents.com/pages/clickads
http://www.clix-cents.com/pages/clickads
1 个解决方案
#1
2
You can get the image by copying it to the clipboard. JavaScript can copy the img to clipboard.
您可以通过将图像复制到剪贴板来获取图像。 JavaScript可以将img复制到剪贴板。
mshtml.HTMLWindow2Class w2 = webBrowser1.Document.Window.DomWindow as mshtml.HTMLWindow2Class;
w2.execScript("var ctrlRange = document.body.createControlRange();ctrlRange.add(document.getElementById('img1'));ctrlRange.execCommand('Copy');", "javascript");
Image image2 = Clipboard.GetImage();
pictureBox1.Image = image2;
#1
2
You can get the image by copying it to the clipboard. JavaScript can copy the img to clipboard.
您可以通过将图像复制到剪贴板来获取图像。 JavaScript可以将img复制到剪贴板。
mshtml.HTMLWindow2Class w2 = webBrowser1.Document.Window.DomWindow as mshtml.HTMLWindow2Class;
w2.execScript("var ctrlRange = document.body.createControlRange();ctrlRange.add(document.getElementById('img1'));ctrlRange.execCommand('Copy');", "javascript");
Image image2 = Clipboard.GetImage();
pictureBox1.Image = image2;