开发者

Image from webbrowser control to picturebox - C#

开发者 https://www.devze.com 2023-02-16 16:53 出处:网络
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

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.

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


You can get the image by copying it to the clipboard. JavaScript can copy the img to clipboard.

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;
0

精彩评论

暂无评论...
验证码 换一张
取 消