C#三夏 - 如何加载上飞一个HTML? [英] c# webcontrol - how to load a html on the fly?

查看:94
本文介绍了C#三夏 - 如何加载上飞一个HTML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用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物业。结果
请注意,它是异步的;当你的下一个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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆