Пример #1
0
 private void listApps_ItemDragging(object sender, Controls.CancelListViewItemDragEventArgs e)
 {
     //禁止拖动“(全局)”
     if (e.Item.Index == 0)
     {
         e.Cancel = true;
     }
 }
Пример #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)
        {
            EventHandler <CancelListViewItemDragEventArgs> handler;

            handler = this.ItemDragging;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Пример #3
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);
        }
Пример #4
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);
            }
        }
Пример #5
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);
        }