public int UpdateUI() { //return 0; //Debug.WriteLine("UpdateUI"); if (this.mFullyActive && (this.m_document != null) && (this.container.mDesignMode == true)) { try { HTMLDocument thisdoc = (HTMLDocument)m_document; //we need IDisplayServices to get the caret position IDisplayServices ds = (IDisplayServices)thisdoc; if (ds == null) { return(HRESULT.S_OK); } IHTMLCaret caret; int iRetVal = ds.GetCaret(out caret); if (caret == null) { return(HRESULT.S_OK); } win32POINT pt = new win32POINT(); caret.GetLocation(out pt, true); IHTMLDocument2 htmldoc = (IHTMLDocument2)this.m_document; IHTMLElement el = htmldoc.ElementFromPoint(pt.x, pt.y); if (el == null) { return(HRESULT.S_OK); } container.mcurrentElement = el; container.InvokeUpdateUI(el); } catch (Exception e) { Debug.WriteLine(e.Message + e.StackTrace); } } //should always return S_OK unless error return(HRESULT.S_OK); }
public int UpdateUI() { if (this.mFullyActive && (this.m_document != null) && (this.container.mDesignMode == true)) { try { mshtml.HTMLDocument thisdoc = (mshtml.HTMLDocument)m_document; //we need IDisplayServices to get the caret position mshtml.IDisplayServices ds = (IDisplayServices)thisdoc; if (ds == null) { return(HRESULT.S_OK); } IHTMLCaret caret; ds.GetCaret(out caret); if (caret == null) { Debug.WriteLine("caret was null"); return(HRESULT.S_OK); } tagPOINT pt = new tagPOINT(); caret.GetLocation(out pt, 1); IHTMLElement el = thisdoc.elementFromPoint(pt.x, pt.y); if (el == null) { Debug.WriteLine("pt was null"); return(HRESULT.S_OK); } container.mcurrentElement = el; container.InvokeUpdateUI(el); } catch (Exception e) { Debug.WriteLine(e.Message + e.StackTrace); } } //should always return S_OK unless error return(HRESULT.S_OK); }