C#三夏 - 如何加载上飞一个HTML? [英] c# webcontrol - how to load a html on the fly?
问题描述
我想使用C#的WebBrowser组件来加载HTML。我抬头一看MSDN,但我找不到任何可以加载一个字符串(HTML)到WebBrowser组件。我只看到导航()方法来加载一个URL。
I would like to load HTML using c#'s webbrowser component. I looked up MSDN, but I can't find anything that can load a string(HTML) into webbrowser component. I only see navigate() method to load a URL.
so..I想如果可能的话以下
so..I would like to the following if possible
String htmlcontent = "<html><head><title>test</title></head><body>my content here</body></html>";
webBrowser1.load(htmlContent)
像this..I负荷没有负荷()
方法。
推荐答案
您正在寻找的<一个href=\"http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.documenttext.aspx\"><$c$c>DocumentText$c$c>物业。结果
请注意,它是异步的;当你的下一个code线运行的内容不一定会被加载。
You're looking for the DocumentText
property.
Note that it's asynchronous; the content will not necessarily loaded when your next line of code runs.
这篇关于C#三夏 - 如何加载上飞一个HTML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!