C#Dev GridView拖动行 移动行

本文介绍如何使用 DevExpress 的 Grid 控件实现数据行的拖拽交换功能。通过一系列的事件监听与处理,使得用户可以直观地通过拖拽操作来改变数据行的位置。此功能适用于需要频繁调整数据顺序的应用场景。

注意,分组不可用:下图为例的,分组不可用

引用:

using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Views.Grid.ViewInfo;

声明:

DataTable _DT = new DataTable();

在 Load 事件里面添加:

this.gridControl1.AllowDrop = true; // 确保能够拖拽
this.gridView1.OptionsSelection.MultiSelect = true; //确保能够多选
this.gridView1.OptionsSelection.EnableAppearanceFocusedCell = false; //确保选定行的背景色一样
this.gridView1.OptionsSelection.EnableAppearanceFocusedCell = false; //确保选定行的背景色一样。
this.gridView1.OptionsBehavior.Editable = false;
this.gridControl1.DragDrop += gridControl1_DragDrop;
this.gridControl1.DragOver += gridControl1_DragOver;
this.gridView1.MouseMove += gridView1_MouseMove;
this.gridView1.MouseDown += gridView1_MouseDown;

_v织布日报BindingSource.DataSource = _DT;

内容:

 #region

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值