Example #1
0
        private void listBoxEx1_Click(object sender, EventArgs e)
        {
            int idx = listBoxEx1.SelectedIndex;

            if (idx != -1)
            {
                ListBoxExRow row = listBoxEx1.Items[idx];
                if (row.ToString().EndsWith("ListBoxExRowText"))
                {
                    MessageBox.Show(string.Format("click:{0}", (row as ListBoxExRowText).Text));
                    return;
                }
            }
        }
Example #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();
 }
Example #3
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();
        }
Example #4
0
 public void AddItem(ListBoxExRow item)
 {
     item.Width = this.Width;
     _rowsHeight += item.Height;
     _items.Add(item);
     this.Refresh();
 }