c# - 如何阻止图像出现在 WebBrowser Control 上?

标签 c# .net

我使用 C# 创建了一个简单的 Web 浏览器,我想阻止图像出现在 WebBrowser 控件上。你能告诉我一个示例代码吗?提前致谢。

最佳答案

您可以像这样从源 htm 中删除图像标签:

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

关于c# - 如何阻止图像出现在 WebBrowser Control 上?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2385003/

相关文章:

c# - GetHashCode方法在asp.net core中为相同的字符串返回不同的值

c# - SSIS 脚本组件 - 更改目标 .net 版本不断恢复

java - 试图将 api 身份验证从 iOS 应用程序复制到 java 中,不要用户理解代码

c# - 如何确定 List<Object> 的对象?

c# - 你在哪里存储验证逻辑?

c# - 需要硬编码密码

c# - 即使 if 语句为真,函数也返回假

c# - 错误 : Could not load file or assembly 'Microsoft. Practices.ServiceLocation,版本 = 1.0.0.0

.net - ASP.NET MVC 验证组?

.net - .NET 进程可以分配的最大内存