Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Show HTML in Windows Application

Show HTML in Windows Application

Scheduled Pinned Locked Moved C#
questioncsharphtmldatabasevisual-studio
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    D D de Kerf
    wrote on last edited by
    #1

    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

    S R 2 Replies Last reply
    0
    • D D D de Kerf

      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

      S Offline
      S Offline
      Stephane Rodriguez
      wrote on last edited by
      #2

      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.

      D 1 Reply Last reply
      0
      • D D D de Kerf

        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

        R Offline
        R Offline
        Roger Alsing 0
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • S Stephane Rodriguez

          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.

          D Offline
          D Offline
          D D de Kerf
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups