查看资源中的HTML文件 [英] View the HTML file in the resource
本文介绍了查看资源中的HTML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在资源中显示加载的HTML文件webbrowser?
解决方案
在表单中使用WebBrowser控件。
以下代码只显示'about:blank'消息,替换为您的文档。
对于C#
private void DisplayHtml( string html)
{
webBrowser1。导航( about:blank);
if (webBrowser1.Document!= null )
{
webBrowser1.Document.Write( string .Empty);
}
webBrowser1.DocumentText = html;
}
对于VB.NET
私人 Sub DisplayHtml( ByVal html As 字符串)
webBrowser1.Navigate( about:blank)
如果 webBrowser1.Document IsNot Nothing 然后
webBrowser1.Document.Write( String .Empty)
结束 如果
webBrowser1.DocumentText = html
结束 Sub
注意:在处理向用户显示的内容之前,应将AllowNavigation属性设置为true / BLOCKQUOTE>
How a loaded HTML files can be displayed webbrowser in the resource?
解决方案Use WebBrowser control in form.
The following code display only 'about:blank' message, replace with your doc.
For C#
private void DisplayHtml(string html) { webBrowser1.Navigate("about:blank"); if (webBrowser1.Document != null) { webBrowser1.Document.Write(string.Empty); } webBrowser1.DocumentText = html; }
For VB.NET
Private Sub DisplayHtml(ByVal html As String) webBrowser1.Navigate("about:blank") If webBrowser1.Document IsNot Nothing Then webBrowser1.Document.Write(String.Empty) End If webBrowser1.DocumentText = html End Sub
Note: You should set AllowNavigation property to true before you deal with contents shown to users.
这篇关于查看资源中的HTML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文