ListView鼠标拖
private Point Position = new Point(0, 0);
private void treeFileView_ItemDrag(object sender, ItemDragEventArgs e)
{
DoDragDrop(e.Item, DragDropEffects.Move);
}
private void treeFileView_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(TreeNode)))
{
e.Effect = DragDropEffects.Move;
}
else
e.Effect = DragDropEffects.None;
}
string filePath = Application.StartupPath.ToString() + "\\MyFiles\\";
private void treeFileView_DragDrop(object sender, DragEventArgs e)
{
TreeNode myNode = null;
if (e.Data.GetDataPresent(typeof(TreeNode)))
{
myNode = (TreeNode)(e.Data.GetData(typeof(TreeNode)));
}
else
{
MessageBox.Show("error");
}
Position.X = e.X;
Position.Y = e.Y;
Position = treeFileView.PointToClient(Position);
TreeNode DropNode = treeFileView.GetNodeAt(Position);
if (DropNode.Parent == myNode || DropNode == myNode)
{
}
else if (DirAndFileOperator.IsFile(DropNode))
{
}
else
{
//DirAndFileOperator.MoveFolder(filePath + myNode.FullPath, filePath + DropNode.FullPath + @"\" + myNode.Name);
TreeNode DragNode = myNode;
myNode.Remove();
DropNode.Nodes.Add(DragNode);
}
treeFileView.SelectedNode = DropNode;
DropNode.Expand();
}
private void treeFileView_DragOver(object sender, DragEventArgs e)
{
TreeNode myNode = null;
if (e.Data.GetDataPresent(typeof(TreeNode)))
{
e.Effect = DragDropEffects.Move;
myNode = (TreeNode)(e.Data.GetData(typeof(TreeNode)));
}
else
e.Effect = DragDropEffects.None;
Position.X = e.X;
Position.Y = e.Y;
Position = treeFileView.PointToClient(Position);
TreeNode DropNode = treeFileView.GetNodeAt(Position);
treeFileView.SelectedNode = DropNode;
}
ListView鼠标拖的更多相关文章
- CSharpGL(20)用unProject和Project实现鼠标拖拽图元
CSharpGL(20)用unProject和Project实现鼠标拖拽图元 效果图 例如,你可以把Big Dipper这个模型拽成下面这个样子. 配合旋转,还可以继续拖拽成这样. 当然,能拖拽的不只 ...
- JavaScript鼠标拖拽特效及相关问题总结
#div1{width:200px;height:200px;background:red;position:absolute;} #div2{width:200px;height:200px;bac ...
- 一款基于jQuery的支持鼠标拖拽滑动焦点图
记得之前我们分享过一款jQuery全屏广告图片焦点图,图片切换效果还不错.今天我们要分享另外一款jQuery焦点图插件,它的特点是支持鼠标拖拽滑动,所以在移动设备上使用更加方便,你只要用手指滑动屏幕即 ...
- 【狼】unity 鼠标拖拽物体实现任意角度自旋转
主要涉及函数 Input.GetAxis(“Mouse x”) 可取得鼠标横向(x轴)移动增量 Input.GetAxis(“Mouse y”) 可取得鼠标竖向(y轴)移动增量 通过勾股定理获取拖拽长 ...
- NGUI对象跟随鼠标拖拽移动
public Camera WNGUICamera; Vector3 _WoldPosition;//指针的初始位置 // Vector3 _WoldAng; Vector3 WscreenSpace ...
- ListView列表拖拽排序
ListView列表拖拽排序能够參考Android源代码下的Music播放列表,他是能够拖拽的,源代码在[packages/apps/Music下的TouchInterceptor.java下]. 首 ...
- 鼠标拖拽定位和DOM各种尺寸详解
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- Arcgis for qml - 鼠标拖拽移动
以实现鼠标拖拽文本图层为例 GitHub:ArcGIS拖拽文本 作者:狐狸家的鱼 目的是利用鼠标进行拖拽. 实现两种模式,一种是屏幕上的拖拽,第二种是地图上图层的挪动. 屏幕上的拖拽其实跟ArcGIS ...
- html5的鼠标拖拽
鼠标拖拽 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF- ...
随机推荐
- Leetcode 17. Letter Combinations of a Phone Number(水)
17. Letter Combinations of a Phone Number Medium Given a string containing digits from 2-9 inclusive ...
- R 保存图片——tiff
tiff(filename = "c:\\aaa.tiff", res = 800, pointsize = 2) plot(1:100) dev.off() tiff(file= ...
- php开发常用技巧总结
1.[本地开启xdebug导致执行时间超max_execution_time产生的问题处理方法]xdebug开启,会导php执行速度慢,超max_execution_time,这种情况下有必要合理设置 ...
- Internet History, Technology, and Security(week6)——Technology: Transport Control Protocol(TCP)
前言: 这周开始学习分层网络模型的第三层,传输层. Transport/Reliability: Transport Layer TCP层的目的是补偿IP层中可能出现的错误,并充分利用可用资源.由于I ...
- SpringCloud 教程 (二) 服务链路追踪(Spring Cloud Sleuth)
一.简介 Add sleuth to the classpath of a Spring Boot application (see below for Maven and Gradle exampl ...
- cmd开启3389
如何用CMD开启3389与查看3389端口 开启 REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server / ...
- [CSP-S模拟测试]:辣鸡(ljh) (暴力)
题目描述 辣鸡$ljh\ NOI$之后就退役了,然后就滚去学文化课了.然而在上化学课的时候,数学和化学都不好的$ljh$却被一道简单题难住了,受到了大佬的嘲笑.题目描述是这样的:在一个二维平面上有一层 ...
- Mybatis传多个参数(三种解决方案) mapper.xml的sql语句修改!
第一种 Public User selectUser(String name,String area); 对应的Mapper.xml <select id="selectUser&qu ...
- matlab 重命名文件和文件夹
1.查看文件存在 dir() 若存在,返回文件信息 dir(‘test.txt’) %查看当前目录是否存在test.txt文件 dir(‘C:\test.txt’) %查看指定目录是否存在 ...
- MyISAM、InnoDB、Memory这3个常用引擎支持的索引类型
表格对比了MyISAM.InnoDB.Memory这3个常用引擎支持的索引类型: 索引 MyISAM引擎 InnoDB引擎 Memory引擎 B-Tree索引 支持 支持 支持 HASH索引 不支持 ...