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- ...
随机推荐
- 【SaltStack官方版】—— states教程, part 2 - 更复杂的states和必要的事物
states tutorial, part 2 - more complex states, requisites 本教程建立在第1部分涵盖的主题上.建议您从此处开始. 在Salt States教程的 ...
- react native 实现TODO APP
前端有一个todo app非常适合入门练手 react-native 实现todo app:https://github.com/nwgdegitHub/TODO_RN.git
- Thread的几种方法的使用
1:setPriority() 设置线程的优先级,从1 到10. 5是默认的. 1是最低优先级. 10是最高优先级 public class MyThread01 implements Runn ...
- STM32内部时钟设置-寄存器版
STM32寄存器版本——内部时钟设置 同时要记得把延时初始化函数设置好 //系统时钟初始化函数 //pll:选择的倍频数,从2开始,最大值为16 //pll:选择的倍频数,这里使用内部时钟,PLL为4 ...
- HDU 4348 SPOJ 11470 To the moon
Vjudge题面 Time limit 2000 ms Memory limit 65536 kB OS Windows Source 2012 Multi-University Training C ...
- scanf() 与 gets()--转载
scanf( )函数和gets( )函数都可用于输入字符串,但在功能上有区别.若想从键盘上输入字符串"hi hello",则应该使用__gets__函数. gets可以接收空格:而 ...
- spring bean.xml
http://blog.csdn.net/lanshengsheng2012/article/details/9011635
- 尚硅谷Docker---1-5、docker简介
尚硅谷Docker---1-5.docker简介 一.总结 一句话总结: docker是环境打包:有点像windows镜像 docker的实质:缩小版.精细版.高度浓缩版的一个小型的linux系统 1 ...
- bash如何向上向下移动历史命令记录
bash如何在 历史命令记录 中上下移动? 通过bash本身的设置,就可以做到! : 用shift+up , shift+down 来上下移动 : 单纯的up/down是调用历史命令
- 20170809--JS操作Select备忘
// 1.判断select选项中 是否存在Value="paraValue"的Item function jsSelectIsExitItem(objSelect, objItem ...