Show HTML in Windows Application
-
Hi, I have some postings in a database and these postings are all noted in HTML-form because my initial idea was to show them from a web-application. Now I also want to show them through a windows application, the question is: how? So I want to render HTML and show it in a .NET Windows Application. But I can't find a control to show the HTML. I know there is a control to show Richt Text Format, but that's still no HTML. I also know you can use the Internet Explorer ActiveX component, but I don't really want to, because that component can only show HTML from physical files and URL's, not directly from a String.... Does anybody know about the existence of a .NET-component that can show HTML directly from a string or do I really have to use the IE-component??? Structured programming vs. chaotic mind boggling
-
Hi, I have some postings in a database and these postings are all noted in HTML-form because my initial idea was to show them from a web-application. Now I also want to show them through a windows application, the question is: how? So I want to render HTML and show it in a .NET Windows Application. But I can't find a control to show the HTML. I know there is a control to show Richt Text Format, but that's still no HTML. I also know you can use the Internet Explorer ActiveX component, but I don't really want to, because that component can only show HTML from physical files and URL's, not directly from a String.... Does anybody know about the existence of a .NET-component that can show HTML directly from a string or do I really have to use the IE-component??? Structured programming vs. chaotic mind boggling
D.D. de Kerf wrote: Does anybody know about the existence of a .NET-component that can show HTML directly from a string or do I really have to use the IE-component??? There is no UI Windows Forms components related to HTML rendering. With enough spare time ahead, you may write a simple HTML renderer from scratch (and post it :omg: ). D.D. de Kerf wrote: I really have to use the IE-component What's wrong with it? Drag&drop the web component into your Form, then Navigate the about:blank page, and then retrieve the mshtml (microsoft.mshtml.dll primary interop assembly) object model, get the IHTMLDocument2 interface, and create an HTML rendering from a string using the IHTMLDocument2.write(...) method call. This article[^] uses mshtml.
-
Hi, I have some postings in a database and these postings are all noted in HTML-form because my initial idea was to show them from a web-application. Now I also want to show them through a windows application, the question is: how? So I want to render HTML and show it in a .NET Windows Application. But I can't find a control to show the HTML. I know there is a control to show Richt Text Format, but that's still no HTML. I also know you can use the Internet Explorer ActiveX component, but I don't really want to, because that component can only show HTML from physical files and URL's, not directly from a String.... Does anybody know about the existence of a .NET-component that can show HTML directly from a string or do I really have to use the IE-component??? Structured programming vs. chaotic mind boggling
Hi , we have a free but limited control that _might_ do what you want. http://www.compona.com/WikiEngine/WikiPageViewer.ascx?ID=44[^] it has its own rendering engine and can render with different font settings and images. but as i said , it is limited , no tables , no stylesheets , no selections(!) etc. basiclly the following tags are implemented <a href=... <font face=... size=... color=...(named colors only right now) <br> <hr> <img src="file://... or src="1" (refering to an image in an attached imagelist) <b> <i> <u> it wordwraps and can also autosize to make the content fit. //Roger - Compona
-
D.D. de Kerf wrote: Does anybody know about the existence of a .NET-component that can show HTML directly from a string or do I really have to use the IE-component??? There is no UI Windows Forms components related to HTML rendering. With enough spare time ahead, you may write a simple HTML renderer from scratch (and post it :omg: ). D.D. de Kerf wrote: I really have to use the IE-component What's wrong with it? Drag&drop the web component into your Form, then Navigate the about:blank page, and then retrieve the mshtml (microsoft.mshtml.dll primary interop assembly) object model, get the IHTMLDocument2 interface, and create an HTML rendering from a string using the IHTMLDocument2.write(...) method call. This article[^] uses mshtml.
Well, I didn't ever know that I could use this write-function. It is also the first time I've ever got it working. Here are the steps: 1) Add Explorer to your toolbox (customize toolbox -> COM components -> Microsoft Web Browser) and add it to your form 2) Add a reference in your C# project to Microsoft.mshtml 3) use mshtml in your .cs-file like this:
using mshtml;
4) Browse to about:blank like this (ieBrowser is the browser-component):object o = new object(); ieBrowser.Navigate("about:blank", ref o, ref o, ref o, ref o);
5) Fill the HTML from a string like this:IHTMLDocument2 doc; object oDoc = ieBrowser.Document; doc = (IHTMLDocument2)oDoc; doc.write("This is **bold** and this is _italic_");
That should do the trick. Thanks for the tips!!! Structured programming vs. chaotic mind boggling