Ejemplo n.º 1
0
        public void ItemRemoveAt(IEnumerable <int> indices)
        {
            ItemRemoveAtBase(indices);

            /* === 更新イベント === */
            UpdatedList?.Invoke(this, EventArgs.Empty);
        }
Ejemplo n.º 2
0
        public void ItemAddRange(IEnumerable <object> items)
        {
            ItemAddBase(items);

            /* === 更新イベント === */
            UpdatedList?.Invoke(this, EventArgs.Empty);
        }
Ejemplo n.º 3
0
        public void ItemRemoveAt(int index)
        {
            ItemRemoveAtBase(new [] { index });

            /* === 更新イベント === */
            UpdatedList?.Invoke(this, EventArgs.Empty);
        }
Ejemplo n.º 4
0
        public void ItemClear()
        {
            items_ = new List <object>();

            /* すぐにメモリに反映させるためにGCを手動リセット */
            GC.Collect();

            VirtualListSize = items_.Count;

            /* === 更新イベント === */
            UpdatedList?.Invoke(this, EventArgs.Empty);
        }
Ejemplo n.º 5
0
        protected override void OnDragDrop(DragEventArgs e)
        {
            if (ReadOnly)
            {
                return;
            }

            var item_drag = (int[])e.Data.GetData(typeof(int[]));

            if (item_drag == null)
            {
                return;
            }

            /* === 移動するアイテムを抽出する === */
            /* 削除するとインデックスがずれてしまうため降順で検索する */
            var move_items = new Stack <object>();

            foreach (var value in item_drag.OrderByDescending(item => item))
            {
                move_items.Push(items_[value]);
                ItemRemoveAtBase(new [] { value });
            }

            /* === 挿入位置(アイテム)を取得する === */
            var insert_pos   = PointToClient(new Point(e.X, e.Y));
            var insert_obj   = GetItemAt(insert_pos.X, insert_pos.Y);
            var insert_index = 0;

            if (insert_obj != null)
            {
                insert_index = insert_obj.Index;
            }
            else if (insert_pos.Y > 0)
            {
                insert_index = (int)items_.Count;
            }

            /* === 挿入する === */
            ItemInsertBase(insert_index, move_items);

            /* === 更新イベント === */
            UpdatedList?.Invoke(this, EventArgs.Empty);
        }