void initMshtml() { //don't create in design mode if (this.DesignMode) { return; } if (this.isCreated) { return; //can't create if already created } // force creating Host handle since we need it to parent MSHTML if (!this.IsHandleCreated) { IntPtr hostHandle = Handle; } site = new HtmlSite(this); site.CreateDocument(); if (this.Visible) { site.ActivateDocument(); } else { this.bNeedsActivation = true; this.activateTimer.Enabled = true; } this.mHtmlDoc = (HTMLDocument)site.Document; this.mDocHTML = new DocHTML(mHtmlDoc); if (this.mDesignMode) { IHTMLDocument2 htmldoc = (IHTMLDocument2)this.mHtmlDoc; htmldoc.SetDesignMode("On"); } site.SetPropertyNotifyEvents(); if (url != String.Empty) { LoadUrl(url); } else { //always initialize with at least the blank url LoadUrl("About:Blank"); } if (sDocument != String.Empty) { LoadDocument(sDocument); } else { if (this.mDesignMode) { LoadDocument("<html></html>"); } } }