/////////////////////////////////////////////////////////////////////////// // Event Handlers protected virtual void OnParentResize(object src, EventArgs e) { if (tridentView != null) { NativeMethods.COMRECT r = new NativeMethods.COMRECT(); NativeMethods.GetClientRect(parentControl.Handle, r); tridentView.SetRect(r.ToWin32InteropCOMRECT()); } }
/// <include file='doc\MSHTMLHost.uex' path='docs/doc[@for="TridentSite.ActivateDocument"]/*' /> /// <devdoc> /// Activates the mshtml instance /// </devdoc> protected void ActivateDocument() { Debug.Assert(tridentOleObject != null, "How'd we get here when trident is null!"); try { Debug.WriteLineIf(StyleBuilder.StyleBuilderSwitch.TraceVerbose, "Activating trident..."); NativeMethods.COMRECT r = new NativeMethods.COMRECT(); NativeMethods.GetClientRect(parentControl.Handle, r); tridentOleObject.DoVerb(NativeMethods.OLEIVERB_UIACTIVATE, IntPtr.Zero, (NativeMethods.IOleClientSite) this, 0, parentControl.Handle, r.ToWin32InteropCOMRECT()); } catch (Exception e) { Debug.Fail(e.ToString()); } }
/////////////////////////////////////////////////////////////////////////// // IOleDocumentSite Implementation public virtual int ActivateMe(NativeMethods.IOleDocumentView pViewToActivate) { Debug.WriteLineIf(StyleBuilder.StyleBuilderSwitch.TraceVerbose, "CTridentSite: IOleDocumentSite::ActivateMe"); Debug.Assert(pViewToActivate != null, "Expected the view to be non-null"); if (pViewToActivate == null) { return(NativeMethods.E_INVALIDARG); } //throw new COMException(String.Empty, NativeMethods.E_INVALIDARG); NativeMethods.COMRECT r = new NativeMethods.COMRECT(); NativeMethods.GetClientRect(parentControl.Handle, r); tridentView = pViewToActivate; tridentView.SetInPlaceSite((NativeMethods.IOleInPlaceSite) this); tridentView.UIActivate(1); tridentView.SetRect(r.ToWin32InteropCOMRECT()); tridentView.Show(1); return(NativeMethods.S_OK); }