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麼.可是,这只能测任意两点的直线距离,用途不够实际啊.比如,我想测试北京天安门到北京后 ...
随机推荐
- bzoj 4503 两个串
Description 兔子们在玩两个串的游戏.给定两个字符串S和T,兔子们想知道T在S中出现了几次, 分别在哪些位置出现.注意T中可能有“?”字符,这个字符可以匹配任何字符. Input 两行两个字 ...
- linux-系统调用
p { margin-bottom: 0.1in; line-height: 120% } ● Fork() 创建子进程. 创建单个子进程: pid_t pid; pid = fork(); if(p ...
- p4lang/switch make bm-switchsai 出现内存不足导致的Error
报错如下: Compiling : bm::dc.cpp g++: internal compiler error: Killed (program cc1plus) Please submit a ...
- webrtc初识
最近由于项目的需求,开始接触了webrtc这个东西.没想到这东西的门槛还是蛮高的,接下来分享一下我所踩过的坑,希望对以后初次接触这个东西的人有所帮助. webrtc官网 第一步当然是看官方主页了(ww ...
- centos下JDK的卸载与安装
linux是自带JDK的,但是它自带的JDK是openJDK,我们如果需要安装ant之类的软件,使用这个JDK是不行的.所以我们需要卸载linux下自带的JDK,并安装我们准备的JDK. JDK的卸载 ...
- 获取真实Ip地址
/** * @author zhoulongqin * @see 获取客户端ip * @param * @return 客户端ip(String) webserve ip不一定获取的到 */ publ ...
- BAT常用脚本汇总
1.取得时间戳 @echo off set date0=%date:~0,10% set hour0=%time:~0,2% set time0=%time:~0,2%%time:~3,2%%time ...
- Nodejs:fs模块 & rimraf模块
模块fs:可以通过他管理文件系统,文件的写入,删除等操作 模块rimraf: 递归删除文件的node插件,在项目的文件编译之前,可以清除dist文件夹里的内容 API样例: var fs = ...
- 关于(object sender, EventArgs e)
sender是事件源 就是指发起这个事件的对象(控件)//表示触发事件的那个控件比如说你按下按钮,那么sender就是按钮 又如:textboxchange,sender就是该textbox,在事 ...
- vim - copy/paste a word
1. http://stackoverflow.com/questions/7797068/copying-a-word-and-pasting-over-a-word viwp - visually ...