예제 #1
0
        protected override void OnSizeChanged(EventArgs e)
        {
            using (var detect = Detect.Reentry(this, "OnSizeChanged"))
            {
                if (detect.DidReenter)
                {
                    return;
                }

                var height = this.Height;
                base.OnSizeChanged(e);
                if (height > this.Height)                   //this is for the search box, where the ws label could be much taller that the list text
                {
                    this.Height = height;
                }

                if (_listBox != null)
                {
                    //NB: this height can be multiple lines, so we don't just want the Height
                    //this._listBox.ItemHeight = Height;
                    _listBox.ItemHeight = _listBox.Font.Height;
                }
                if (_listBox != null && _autoSizePopup)
                {
                    if (_listBox.Width < Width)
                    {
                        _listBox.Width = Width;
                    }
                }
            }
        }