C#鼠标拖动控件改变位置并绘制虚框
来源:互联网 发布:淘宝宝贝名称优化 编辑:程序博客网 时间:2024/05/21 17:31
private Point downPoint;
private Rectangle downRectangle;
private Rectangle lastRectangle;
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button != MouseButtons.Left) return;
downPoint = e.Location;
downRectangle =
new Rectangle(0, 0, ((Control)sender).Width, pictureBox1.Height);
downRectangle.Offset(((Control)sender).PointToScreen(new Point(0, 0)));
ControlPaint.DrawReversibleFrame(
downRectangle, Color.White, FrameStyle.Thick);
lastRectangle = downRectangle;
}
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button != MouseButtons.Left) return;
ControlPaint.DrawReversibleFrame(
lastRectangle, Color.White, FrameStyle.Thick);
Rectangle rectangle = downRectangle;
rectangle.Offset(e.X - downPoint.X, e.Y - downPoint.Y);
ControlPaint.DrawReversibleFrame(
rectangle, Color.White, FrameStyle.Thick);
lastRectangle = rectangle;
}
private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button != MouseButtons.Left) return;
ControlPaint.DrawReversibleFrame(
lastRectangle, Color.White, FrameStyle.Thick);
pictureBox1.Location = new Point(
((Control)sender).Location.X + e.X - downPoint.X,
((Control)sender).Location.Y + e.Y - downPoint.Y);
}
- C#鼠标拖动控件改变位置并绘制虚框
- C#鼠标拖动控件改变位置并绘制虚框
- C#鼠标拖动控件改变位置并绘制虚框
- 鼠标拖动Panel控件,鼠标拖动改变位置
- Winform鼠标拖动改变控件大小、移动控件位置
- 在运行时通过鼠标拖动移动控件位置及改变控件的大小
- 在运行时通过鼠标拖动移动控件位置及改变控件的大小
- 在运行时通过鼠标拖动移动控件位置及改变控件的大小
- c# 鼠标拖动控件 张宇轩
- Android拖动控件改变其位置
- Android拖动控件改变其位置
- .net,C#如何在运行时通过鼠标拖动改变控件的大小
- C#如何在运行时通过鼠标拖动改变控件的大小
- .net c#拖动控件,移动控件位置
- 鼠标样式改变 隐藏鼠标在鼠标位置绘制图片,当鼠标经过时改变样式
- C#鼠标拖动任意控件(winform)
- c# winform 一个可以用鼠标改变控件位置和大小的类,调用即可
- c# winform 一个可以用鼠标改变控件位置和大小的类,调用即可
- 将 Windows IPC 应用程序移植到 Linux,第 2 部分: 信号量和事件
- ffffffffff
- 将 Windows IPC 应用程序移植到 Linux,第 3 部分: 信号
- 使用JAVA类——ProgressMonitorInputStream
- 为了提高编程水平,来到了这里!
- C#鼠标拖动控件改变位置并绘制虚框
- 第十七章
- 如何判断数据库数据类型 ad0
- 欢迎大家多多指点!提提人气!
- C4.5 VC6.0 程序源码
- java安全体系结构
- 如何在MIDP中实现图片放缩(转自linuxmine)
- 1024*768 固定多少宽度才不会出现滚动条
- 我回来了....