嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元微信扫码支付:2 元
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
根据鼠标光标位置动态移动生成的图标
private void PictureBox_MouseDown(object sender, MouseEventArgs e) {
if (e.Button == MouseButtons.Left) {
isDrag = true;
//重新设置rect的位置,跟随鼠标移动
rect.Location = getPointToForm(new Point(e.Location.X - mouseDownPoint.X, e.Location.Y - mouseDownPoint.Y), sender);
this.Refresh();
}
}
private void PictureBox_MouseMove(object sender, MouseEventArgs e) {
if (e.Button == MouseButtons.Left) {
isDrag = true;
//重新设置rect的位置,跟随鼠标移动
rect.Location = getPointToForm(new Point(e.Location.X - mouseDownPoint.X, e.Location.Y - mouseDownPoint.Y), sender);
this.Refresh();
}
}
private void PictureBox_MouseUp(object sender, MouseEventArgs e) {
if (e.Button == MouseButtons.Left) {
if (isDrag) {
isDrag = false;
//移动control到放开鼠标的地方
actX = rect.Location.X - (picWidth / 2);
actY = rect.Location.Y - (picHeight / 2);
(sender as PictureBox).Location = new Point(rect.Location.X - (picWidth / 2), rect.Location.Y - (picHeight / 2));
this.Refresh();
deviceInfo.x = actX;
deviceInfo.y = actY;
}
reset();
}
}