[英]How do you display HTML in windows app?
I have a bunch of HTML code that I need to display in a label/textbox in a windows app written in c#. 我有一堆HTML代码,我需要在用c#编写的windows应用程序的标签/文本框中显示。 It should be in such a way that the output shows the HTML formatted text, rather than the HTML code itself.
它应该以输出显示HTML格式文本的方式,而不是HTML代码本身。
How can I do this? 我怎样才能做到这一点?
Render your HTML in WebBrowser control. 在WebBrowser控件中呈现HTML。 It has special events for document and you can iterate by tags like this Hope it will help you;)
它有文件的特殊事件,你可以像这样的标签迭代希望它会帮助你;)
There's a web browser control using IE's rendering engine to display HTML content. 有一个Web浏览器控件使用IE的渲染引擎来显示HTML内容。 You might as well be able to do some simple parsing yourself and use a RTF control but that way you will be rather restricted.
你也可以自己做一些简单的解析并使用RTF控件,但这样你会受到相当的限制。
If WebBrowser doesn't suit your needs you can check out these libraries with HTML label/control support 如果WebBrowser不能满足您的需求,您可以使用HTML标签/控件支持查看这些库
Telerik Controls for WinForms (Not Free) http://www.telerik.com/products/winforms.aspx Telerik控制WinForms(非免费) http://www.telerik.com/products/winforms.aspx
GDI+ HTMLRenderer (Free, Open Source) GDI + HTMLRenderer(免费,开源)
http://www.codeproject.com/KB/GDI-plus/HtmlRenderer.aspx?msg=2934040 http://www.codeproject.com/KB/GDI-plus/HtmlRenderer.aspx?msg=2934040
只读模式下的HTML编辑器 (MSHTML的包装器,Internet Explorer的呈现部分)可能就是您所需要的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.