dev TreeList拖拽
一、说明
使用dev控件,TreeList1向TreeList2拖拽
二、属性
//允许拖拽
treeList1.AllowDrop = true;
treeList2.AllowDrop = true;
//允许多行选择
treeList1.OptionsSelection.MultiSelect = true;
三、代码
- #region tree拖拽操作
- TreeListHitInfo downHitInfo = null;
- #region 拖出
- private void treeList1_MouseMove(object sender, MouseEventArgs e)
- {
- TreeList treelist = sender as TreeList;
- if (e.Button == MouseButtons.Left && downHitInfo != null)
- {
- if (treeList1.Selection.Count == )
- return;
- Size dragSize = SystemInformation.DragSize;
- Rectangle dragRect = new Rectangle(new Point(downHitInfo.MousePoint.X - dragSize.Width / ,
- downHitInfo.MousePoint.Y - dragSize.Height / ), dragSize);
- if (!dragRect.Contains(new Point(e.X, e.Y)))
- {
- List<TreeListNode> node = new List<TreeListNode>();
- foreach (TreeListNode n in treeList1.Selection)
- {
- node.Add(n);
- }
- treelist.DoDragDrop(downHitInfo.Node, DragDropEffects.Move);
- downHitInfo = null;
- DevExpress.Utils.DXMouseEventArgs.GetMouseArgs(e).Handled = true;
- }
- }
- }
- private void treeList1_MouseDown(object sender, MouseEventArgs e)
- {
- TreeList treelist = sender as TreeList;
- downHitInfo = null;
- TreeListHitInfo hitInfo = treelist.CalcHitInfo(new Point(e.X, e.Y));
- if (Control.ModifierKeys != Keys.None) return;
- if (e.Button == MouseButtons.Left)
- {
- downHitInfo = hitInfo;
- }
- }
- #endregion
- #region 拖入
- private void treeList2_DragOver(object sender, DragEventArgs e)
- {
- TreeList treelist = sender as TreeList;
- if (treelist != null)
- {
- e.Effect = DragDropEffects.Move;
- }
- }
- private void treeList2_DragEnter(object sender, DragEventArgs e)
- {
- e.Effect = DragDropEffects.Move;
- }
- private void treeList2_DragDrop(object sender, DragEventArgs e)
- {
- List<TreeListNode> nodes = e.Data.GetData(typeof(List<TreeListNode>)) as List<TreeListNode>;
- TreeList grid = sender as TreeList;
- DataTable table = grid.DataSource as DataTable;
- if (nodes != null && nodes.Count > && table != null)
- {
- foreach (TreeListNode node in nodes)
- {
- treeList1.Nodes.Add(node);
- }
- }
- }
- #endregion
- #endregion
dev TreeList拖拽的更多相关文章
- Dev Grid拖拽移动行
效果图 源码下载 拖拽时带行截图效果实现代码 /// <summary> /// 拖拽帮助类 /// </summary> public static class DragHe ...
- dev gridview拖拽数据移动
设置属性gridView1.OptionsSelection.EnableAppearanceFocusedCell = false; //确保选定行的背景色一样. private BindingLi ...
- 浅谈DevExpress<四>:TreeList中的拖拽功能
本篇要实现的目标,简单来说就是把一个treelist的节点用鼠标拖到另外的节点(自身或其他的listview)上,如下图: 1
- Dev GridView行拖拽
http://blog.csdn.net/keyrainie/article/details/8513802 http://www.cnblogs.com/qq4004229/archive/2012 ...
- dev GridControl实现拖拽
一.示例说明 以gridControl1和gridControl2为例,从gridControl1拖拽行到gridControl2中去. 二.属性设置 gridControl2.AllowDrop = ...
- dev gridview 单元格值拖拽替换
public class GridViewDropCell { //dvginfo根据鼠标点击的x.y坐标获取该点的相关信息 private GridHitInfo downHitInfo; priv ...
- Html5+NodeJS——拖拽多个文件上传到服务器
实现多文件拖拽上传的简易Node项目,可以在github上下载,你可以先下载下来:https://github.com/Johnharvy/upLoadFiles/. 解开下载下的zip格式包,建议用 ...
- React Editor 应用编辑器(1) - 拖拽功能剖析
这是可视化编辑器 Gaea-Editor 的第一篇连载分析文章,希望我能在有限的篇幅讲清楚制作这个网页编辑器的动机,以及可能带来的美好使用前景(画大饼).它会具有如下几个特征: 运行在网页 文档流布局 ...
- 【百度地图API】如何制作可拖拽的沿道路测距
原文:[百度地图API]如何制作可拖拽的沿道路测距 摘要: 地图测距,大家都会,不就map.getDistance麼.可是,这只能测任意两点的直线距离,用途不够实际啊.比如,我想测试北京天安门到北京后 ...
随机推荐
- apache 虚拟目录
补充:必须使用80端口才能正常使用 C:\Windows\System32\drivers\etc\hosts 最后添加上: 127.0.0.1 shenyi.com 127.0.0.1 offli ...
- 人工神经网络NN
[面向代码]学习 Deep Learning系列 http://blog.csdn.net/coolluyu/article/details/20214617 正则化的最小二乘法 深入浅出LSTM神经 ...
- Git 恢复某个文件指定版本
1. git reflog 找到comit id 2. git reset edf92f a.txt 3. git commit -m "ssss" 4. git checkou ...
- Python 中的枚举类型~转
Python 中的枚举类型 摘要: 枚举类型可以看作是一种标签或是一系列常量的集合,通常用于表示某些特定的有限集合,例如星期.月份.状态等. 枚举类型可以看作是一种标签或是一系列常量的集合,通常用于表 ...
- maven 依赖
依赖排除 当一个项目A依赖项目B,而项目B同时依赖项目C,如果项目A中因为各种原因不想引用项目C,在配置项目B的依赖时,可以排除对C的依赖. 示例(假设配置的是A的pom.xml,依赖关系为:A -- ...
- 著名的sql注入问题-问题的原因分析及总结
Statement安全漏洞(sql注入问题)问题展示: 首先我的Mysql数据库中有一张users表,如下图所示 /** * 根据用户名查询用户 * @param username 需要查询的用户名 ...
- ubuntu不能正常登录
在ubuntu登录界面,输入密码后,出现一个界面后一闪而过又返回登录界面.查看auth.log发现如下错误 May 15 15:42:19 tim-vm lightdm: pam_unix(light ...
- Open Live Writer 安装
Open Live Writer来源 Windows Live Writer在2012年就停止了更新,Open Live Writer是由Windows Live WriterWriter更名而来,是 ...
- LeetCode Design Hit Counter
原题链接在这里:https://leetcode.com/problems/design-hit-counter/. 题目: Design a hit counter which counts the ...
- 高级java必会系列一:多线程的简单使用
众所周知,开启线程2种方法:第一是实现Runable接口,第二继承Thread类.(当然内部类也算...)常用的,这里就不再赘述.本章主要分析总结线程池和常用调度类. 一.线程池 1.newCache ...