Yeh that'll work, but you get a real heavy duty axWebBrowser control ..
kinda like killing a fly with a hammer .. but if you must use that .. here
is sample code to render a "text" to a webbrowser control -
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using mshtml;
namespace WindowsApplication2
{
public class Form1 : System.Windows.Forms.Form
{
private AxSHDocVw.AxWebBrowser browser;
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
string url = "about:blank";
object o = System.Reflection.Missing.Value;
browser.Navigate ( url,ref o,ref o,ref o,ref o);
AxSHDocVw.DWebBrowserEvents2_StatusTextChangeEventHandler handler =
new
AxSHDocVw.DWebBrowserEvents2_StatusTextChangeEventHandler
(this.browser_StatusTextChange);
browser.StatusTextChange += handler;
}
private void browser_StatusTextChange
(object sender,
AxSHDocVw.DWebBrowserEvents2_StatusTextChangeEvent e)
{
mshtml.HTMLDocument doc =
(mshtml.HTMLDocument)this.browser.Document;
doc.body.innerHTML = "<H1>foo</H1>";
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(typeof(Form1));
this.browser = new AxSHDocVw.AxWebBrowser();
((System.ComponentModel.ISupportInitialize)(this.browser)).BeginInit();
this.SuspendLayout();
//
// browser
//
this.browser.Enabled = true;
this.browser.Location = new System.Drawing.Point(16,
16);
this.browser.OcxState =
((System.Windows.Forms.AxHost.State)(resources.GetObject("browser.OcxState")
));
this.browser.Size = new System.Drawing.Size(344,
224);
this.browser.TabIndex = 0;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5,
13);
this.ClientSize = new System.Drawing.Size(392, 302);
this.Controls.AddRange(new
System.Windows.Forms.Control[] {
this.browser});
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.browser)).EndInit();
this.ResumeLayout(false);
}
#endregion
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
}
}