修复复制粘贴是位置不能重叠

This commit is contained in:
moco 2024-12-06 00:10:02 +08:00
parent 1af6b54b1f
commit 10208dedcc
2 changed files with 18 additions and 3 deletions

View File

@ -72,6 +72,7 @@ namespace PBAnaly.Module
#region #region
private ShapeForm curShape = ShapeForm.None; private ShapeForm curShape = ShapeForm.None;
private int curShapeIndex; private int curShapeIndex;
private System.Drawing.Point curShapePoint;
public int ImageIndex { get; set; }// 图片加载进来的序号 public int ImageIndex { get; set; }// 图片加载进来的序号
public bool Arrangement { get; set; } public bool Arrangement { get; set; }
@ -1643,7 +1644,7 @@ namespace PBAnaly.Module
curShape = ShapeForm.Polygon; curShape = ShapeForm.Polygon;
} }
curShapePoint = readLoction;
} }
} }
@ -1681,11 +1682,25 @@ namespace PBAnaly.Module
case ShapeForm.Polygon: case ShapeForm.Polygon:
break; break;
case ShapeForm.Rect: case ShapeForm.Rect:
System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle(curShapePoint, new System.Drawing.Size(oldCopyRect.rect.Width,oldCopyRect.rect.Height));
oldCopyRect.rect = rectangle;
rectangles.Add(oldCopyRect); rectangles.Add(oldCopyRect);
break; break;
case ShapeForm.Circle: case ShapeForm.Circle:
int offsetX = curShapePoint.X - oldCopyCircle.center.X;
int offsetY = curShapePoint.Y - oldCopyCircle.center.Y;
// 更新圆心位置
oldCopyCircle.center.X += offsetX;
oldCopyCircle.center.Y += offsetY;
System.Drawing.Point point = new System.Drawing.Point(oldCopyCircle.Radius.X, oldCopyCircle.Radius.Y);
point.X += offsetX;
point.Y += offsetY;
oldCopyCircle.Radius = point;
CircleAndInfoList.Add(oldCopyCircle); CircleAndInfoList.Add(oldCopyCircle);
break; break;
default: default:

View File

@ -364,7 +364,7 @@
this.ctms_strop_stickup, this.ctms_strop_stickup,
this.ctms_strop_delete}); this.ctms_strop_delete});
this.ctms_strop.Name = "ctms_strop"; this.ctms_strop.Name = "ctms_strop";
this.ctms_strop.Size = new System.Drawing.Size(181, 98); this.ctms_strop.Size = new System.Drawing.Size(101, 76);
// //
// toolStripSeparator1 // toolStripSeparator1
// //