html - 将 System.Windows.Controls.WebBrowser 的内容设置为静态 HTML 文字?

标签 html wpf webbrowser-control .net-3.5

我想设置 WPF WebBrowser 控件的内联内容:

<WebBrowser>
    <html>
        <body><b>Inline content.</b></body>
    </html>
</WebBrowser>

或者:

Dim wb As New WebBrowser
wb.Content = "<html><body><b>Programmatic content</b></body></html>"

最佳答案

调用NavigateToString或 NavigateToStream:

wb.NavigateToString("<html><body><b>Programmatic content</b></body></html>");

是的,他们的名字很糟糕。

关于html - 将 System.Windows.Controls.WebBrowser 的内容设置为静态 HTML 文字?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1598030/

相关文章:

html - 使用 Jinja 从列表中动态填充下拉列表

javascript - 每行开头和结尾的填充相同

html - 图片没有完整显示(reactjs,css)

.net - 绑定(bind)到 WPF 中的方法?

wpf - 在 WPF 中旋转 3D 立方体

javascript - 如何从 C# 绑定(bind)到 HTML?

javascript - Angular.js 低质量图像

c# - 设置wpf图像的图像源

C# WebBrowser 组件忽略 window.location.href = url

c# - 将 Dialog/WebBrowser 调整为网页宽度