예제 #1
0
        /// <summary>
        /// Raises the <see cref="ItemDragging" /> event.
        /// </summary>
        /// <param name="e">The <see cref="CancelListViewItemDragEventArgs" /> instance containing the event data.</param>
        protected virtual void OnItemDragging(CancelListViewItemDragEventArgs e)
        {
            EventHandler <CancelListViewItemDragEventArgs> handler;

            handler = this.ItemDragging;

            if (handler != null)
            {
                handler(this, e);
            }
        }
예제 #2
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.ListView.ItemDrag" /> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.Windows.Forms.ItemDragEventArgs" /> that contains the event data.</param>
        protected override void OnItemDrag(ItemDragEventArgs e)
        {
            if (this.AllowItemDrag && this.Items.Count > 1)
            {
                CancelListViewItemDragEventArgs args;

                args = new CancelListViewItemDragEventArgs((ListViewItem)e.Item);

                this.OnItemDragging(args);

                if (!args.Cancel)
                {
                    this.IsRowDragInProgress = true;
                    this.DoDragDrop(e.Item, DragDropEffects.Move);
                }
            }

            base.OnItemDrag(e);
        }