Beispiel #1
0
 public void AddItem(ListBoxExRow item)
 {
     item.Width   = this.Width;
     _rowsHeight += item.Height;
     _items.Add(item);
     this.Refresh();
 }
Beispiel #2
0
 public void RemoveItem(ListBoxExRow item)
 {
     _items.Remove(item);
     _rowsHeight = 0;
     for (int i = 0; i < _items.Count; i++)
     {
         _rowsHeight += ((ListBoxExRow)_items[i]).Height;
     }
     this.Refresh();
 }
Beispiel #3
0
        // リスト横幅の変更。縦サイズを再計算する。
        public void SetWidth(int width)
        {
            if (_setWidth == width)
            {
                return;
            }

            this.Width  = width;
            _rowsHeight = 0;
            for (int i = 0; i < _items.Count; i++)
            {
                ListBoxExRow obj = (ListBoxExRow)_items[i];
                obj.Width       = this.Width;
                _itemHeights[i] = obj.Height;
                _rowsHeight    += obj.Height;
            }
            _setWidth = width;
        }
Beispiel #4
0
        public void InsertItem(ListBoxExRow item, int idx)
        {
            item.Width   = this.Width;
            _rowsHeight += item.Height;
            _items.Insert(idx, item);

            int tmpheight = 0;

            for (int i = 0; i < _items.Count; i++)
            {
                if (tmpheight + ((ListBoxExRow)_items[i]).Height > _scrollTop + Height)
                {
                    if (i > idx)
                    {
                        _scrollTop += item.Height;
                    }
                    break;
                }
                tmpheight += ((ListBoxExRow)_items[i]).Height;
            }

            this.Refresh();
        }