简体   繁体   中英

How can i display stored html codes in webbrowser control in C# windows form application without creating html files on hard drive?

I have a database which has stored HTML code sources for different articles which are not in similar HTML design pattern. I want to display these codes in windows form application control eg WebBrowser control so that it can be displayed in its original HTMLdesign style as if in the browser.But i hope if this process doesn't include creating html files on hard drive to read from it and i wish if there is a way to make the WebBrowser control navigate from objects created in the memory not created on hard drive .. For example i wish if the code could be like this :

HTMLFile myfile = new HTML File (htmlcode);
webbrowser1.Navigate(myfile);

You should be able to do this using the DocumentText property of the WebBrowser control.

For example:

webBrowser1.DocumentText = "<html><body><h1>This is a test</h1></body></html>";

See this post for more info: C# WebBrowser HTML with references to scripts and images

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM