I have a b开发者_StackOverflow中文版unch of HTML code that I need to display in a label/textbox in a windows app written in c#. It should be in such a way that the output shows the HTML formatted text, rather than the HTML code itself.
How can I do this?
Render your HTML in WebBrowser control. It has special events for document and you can iterate by tags like this Hope it will help you;)
Check out WebBrowser
There's a web browser control using IE's rendering engine to display HTML content. 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.
If WebBrowser doesn't suit your needs you can check out these libraries with HTML label/control support
Telerik Controls for WinForms (Not Free) http://www.telerik.com/products/winforms.aspx
GDI+ HTMLRenderer (Free, Open Source)
http://www.codeproject.com/KB/GDI-plus/HtmlRenderer.aspx?msg=2934040
The HTML Editor (a wrapper for MSHTML, the rendering portion of Internet Explorer) in read-only mode might be what you need.
精彩评论