示例#1
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 (AllowItemDrag && Items.Count > 1)
            {
                CancelListViewItemDragEventArgs args;

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

                OnItemDragging(args);

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

            base.OnItemDrag(e);
        }
示例#2
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)
 {
     ItemDragging?.Invoke(this, e);
 }