Quantcast
Channel: HTML Renderer
Viewing all articles
Browse latest Browse all 693

New Post: Large Text issue (solved)

$
0
0
Hello.
First of all I would like to thank you for this awesome control! =)

I've found strange bug. We use embedded base64 images in HTML data to store pictures.
The Text property of HtmlPanel uses base.Text (System.Windows.Forms.Control.Text) to store string data.
If data is very big, >1.2Mb for example, base.Text will be always empty.
        /// <summary>
        /// Gets or sets the text of this panel
        /// </summary>
        [Browsable(true)]
        [Description("Sets the html of this control.")]
        public override string Text
        {
            get { return base.Text; }
            set
            {
                base.Text = value;
                // !!! base.Text will be empty here if value is huge !!!
                if (!IsDisposed)
                {
                    VerticalScroll.Value = VerticalScroll.Minimum;
                    _htmlContainer.SetHtml(Text, _baseCssData);
                    PerformLayout();
                    Invalidate();
                }
            }
        }
The fix solution is to replace base.Text to some private string field.
        private string _text = string.Empty;

        /// <summary>
        /// Gets or sets the text of this panel
        /// </summary>
        [Browsable(true)]
        [Description("Sets the html of this control.")]
        public override string Text
        {
            get { return _text; }
            set
            {
                _text = value;
                if (!IsDisposed)
                {
                    VerticalScroll.Value = VerticalScroll.Minimum;
                    _htmlContainer.SetHtml(Text, _baseCssData);
                    PerformLayout();
                    Invalidate();
                }
            }
        }
I did not tested it properly but it does render the content.

Thank you again and have a nice day!

Viewing all articles
Browse latest Browse all 693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>