Large Text issue (solved)

Mar 21, 2014 at 11:09 AM
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!
Developer
Mar 22, 2014 at 11:23 AM
Indeed a strange bug, someone else reported something similar but i couldn't reproduce the issue even with his input so, guess there is some environment thing to it as well.
Will add the change to the code for HtmlPanel and HtmlLabel.
Thx for finding it.