Ejemplo n.º 1
0
        /// <summary>
        /// 向 IE 控件中追加一段 HTML 内容
        /// </summary>
        /// <param name="strText">HTML 内容</param>
        public void AppendHtml(string strText)
        {
            if (this.webBrowser1.InvokeRequired)
            {
                Delegate_AppendHtml d = new Delegate_AppendHtml(AppendHtml);
                this.webBrowser1.BeginInvoke(d, new object[] { strText });
                return;
            }

            WriteHtml(this.webBrowser1,
                      strText);

            // 因为HTML元素总是没有收尾,其他有些方法可能不奏效
            this.webBrowser1.Document.Window.ScrollTo(0,
                                                      this.webBrowser1.Document.Body.ScrollRectangle.Height);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 向 IE 控件中追加一段 HTML 内容
        /// </summary>
        /// <param name="strText">HTML 内容</param>
        public void AppendHtml(string strText)
        {
            if (this.WebBrowser.InvokeRequired)
            {
                Delegate_AppendHtml d = new Delegate_AppendHtml(AppendHtml);
                this.WebBrowser.BeginInvoke(d, new object[] { strText });
                return;
            }

            Global.WriteHtml(this.WebBrowser,
                strText);
            // Global.ScrollToEnd(this.WebBrowser);

            // 因为HTML元素总是没有收尾,其他有些方法可能不奏效
            this.WebBrowser.Document.Window.ScrollTo(0,
    this.WebBrowser.Document.Body.ScrollRectangle.Height);
        }