开发者

How can you block the image to appear on WebBrowser Control?

I have created a simple web browser 开发者_高级运维using c# and I want to block the images to appear on WebBrowser control. Can you please show me a sample code for this? Thanks in advance.


You can remove image-tags from the source htm like this:

string content = new WebClient().DownloadString(@"http://www.google.com/");
string contentWithoutImages = Regex.Replace(content, @"<img(.|\n)*?>", string.Empty);
webBrowser1.DocumentText = contentWithoutImages;
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜