图片拖拽
来源:互联网 发布:淘宝付款时间限制 编辑:程序博客网 时间:2024/04/30 21:00
和上一贴相同,本帖是其功能的一个拓展,实现图片放大之后的拖拽,如google地图,在地图放大后,拖拽到局部部分查看细节,代码如下:
private void chartControlRunTime_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { initialPoint = e.Location; } } private void chartControlRunTime_MouseUp(object sender, MouseEventArgs e) { lastPoint = e.Location; int xOffset, yOffset; xOffset = lastPoint.X - initialPoint.X; yOffset = lastPoint.Y - initialPoint.Y; chartControlRunTime.Location = new Point(chartControlRunTime.Location.X + xOffset, chartControlRunTime.Location.Y + yOffset); }initialPoint和lastPoint已经定义,分别记录鼠标按下和松开时,其指向位置。定义如下:private Point initialPoint;private Point lastPoint。
本功能的实现原理是:分别记录鼠标按下和释放时的位置,计算出其位差xOffset、yOffset,然后修改图片的location即可。
- 图片滚轮放大缩小,拖拽图片
- 图片传值+图片缩放拖拽
- js 图片拖拽
- flex拖拽图片
- android 拖拽图片
- 图片拖拽
- android 拖拽图片
- 拖拽上传图片
- 拖拽上传图片
- 图片拖拽布局
- HTML5图片拖拽
- 图片拖拽JS
- 图片拖拽
- JavaScript拖拽图片一
- JavaScript拖拽图片二
- JavaScript拖拽图片三
- JavaScript拖拽图片四
- JavaScript拖拽图片一
- 关于达林顿管
- java中 Reader Writer 类对字符流的读写
- set语句
- 有N个人围成一圈,第一个人从1开始报数,报到M的人出列,求最后一个出列的人。
- 晶振电路中如何选择电容C1,C2?
- 图片拖拽
- virtual box中安装CentOS5.6
- 编译IronPythonStudio源代码
- LATEX相关
- 磁珠的作用
- C++程序运行时内存布局之----------简单类实例,成员变量,成员函数,静态成员变量,静态成员函数
- oracle 自定义类型数据插入
- 学生管理系统信息查询部分主要功能总结
- 第二章 Android内核和驱动程序(转)