Kenshim Dev Kenshim Dev - 1 year ago 102
C# Question

HTML rendering in real time : Winforms

As a student, I am trying to build an application. However, I encounter a difficulty. I would like to make my application into two parts. A first where there is a code editor to type HTML and another that shows the rendering of the page in real time.

How to make the second part? It should refresh the view for each change of code in the editor.

I thank all those who could help me. (Sorry for my english, I'm from Switzerland).

Best regards

Answer Source

Its actually quite simple, if youre already writing out your html file, you just need to add the webbrowser control.

When you have the Web browser control on the page you need to give it a source \ url to go to.

WebBrowser1.Navigate("location of your html file here");

Now depending on where your saving your html page is where it needs to pick it up from. I would suggest that you have a textbox on the page which tells the application where to save the file too, but will also server as where to pick the html page up from.

I wouldn't recommend having the page update each time you make a change, I would recommend that you have a button to actually do the refresh for you as if you use the TextChanged event youre going to be calling your page every single character and not actually give it time to load.

so, every save, you should update the view and not before otherwise youre going to give yourself a big issue.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download