连续绘制时优先移动矩形

This commit is contained in:
moco 2024-12-05 21:01:36 +08:00
parent f78da90a18
commit c44efb2674
2 changed files with 38 additions and 35 deletions

View File

@ -237,7 +237,7 @@
this.tableLayoutPanel1.Controls.Add(this.pl_right, 2, 1); this.tableLayoutPanel1.Controls.Add(this.pl_right, 2, 1);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 24); this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 24);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(2);
this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 3; this.tableLayoutPanel1.RowCount = 3;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 55F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 55F));
@ -270,7 +270,7 @@
this.DataProcess_panel.EdgeColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(41)))), ((int)(((byte)(50))))); this.DataProcess_panel.EdgeColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(41)))), ((int)(((byte)(50)))));
this.DataProcess_panel.Location = new System.Drawing.Point(3, 3); this.DataProcess_panel.Location = new System.Drawing.Point(3, 3);
this.DataProcess_panel.Name = "DataProcess_panel"; this.DataProcess_panel.Name = "DataProcess_panel";
this.DataProcess_panel.Padding = new System.Windows.Forms.Padding(5, 5, 5, 5); this.DataProcess_panel.Padding = new System.Windows.Forms.Padding(5);
this.tl_right_main_view.SetRowSpan(this.DataProcess_panel, 2); this.tl_right_main_view.SetRowSpan(this.DataProcess_panel, 2);
this.DataProcess_panel.Size = new System.Drawing.Size(553, 489); this.DataProcess_panel.Size = new System.Drawing.Size(553, 489);
this.DataProcess_panel.SmoothingType = System.Drawing.Drawing2D.SmoothingMode.HighQuality; this.DataProcess_panel.SmoothingType = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
@ -302,7 +302,7 @@
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel1.Location = new System.Drawing.Point(2, 88); this.flowLayoutPanel1.Location = new System.Drawing.Point(2, 88);
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(2);
this.flowLayoutPanel1.Name = "flowLayoutPanel1"; this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(206, 491); this.flowLayoutPanel1.Size = new System.Drawing.Size(206, 491);
this.flowLayoutPanel1.TabIndex = 18; this.flowLayoutPanel1.TabIndex = 18;
@ -642,9 +642,9 @@
this.pl_right.Dock = System.Windows.Forms.DockStyle.Fill; this.pl_right.Dock = System.Windows.Forms.DockStyle.Fill;
this.pl_right.EdgeColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(41)))), ((int)(((byte)(50))))); this.pl_right.EdgeColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(41)))), ((int)(((byte)(50)))));
this.pl_right.Location = new System.Drawing.Point(771, 57); this.pl_right.Location = new System.Drawing.Point(771, 57);
this.pl_right.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.pl_right.Margin = new System.Windows.Forms.Padding(2);
this.pl_right.Name = "pl_right"; this.pl_right.Name = "pl_right";
this.pl_right.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); this.pl_right.Padding = new System.Windows.Forms.Padding(4);
this.tableLayoutPanel1.SetRowSpan(this.pl_right, 2); this.tableLayoutPanel1.SetRowSpan(this.pl_right, 2);
this.pl_right.Size = new System.Drawing.Size(324, 522); this.pl_right.Size = new System.Drawing.Size(324, 522);
this.pl_right.SmoothingType = System.Drawing.Drawing2D.SmoothingMode.HighQuality; this.pl_right.SmoothingType = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
@ -665,16 +665,17 @@
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true; this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.AutoValidate = System.Windows.Forms.AutoValidate.EnablePreventFocusChange; this.AutoValidate = System.Windows.Forms.AutoValidate.EnablePreventFocusChange;
this.ClientSize = new System.Drawing.Size(1103, 608); this.ClientSize = new System.Drawing.Size(1103, 608);
this.Controls.Add(this.thunderLabel1); this.Controls.Add(this.thunderLabel1);
this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.tableLayoutPanel1);
this.DrawerAutoHide = false; this.DrawerAutoShow = true;
this.FormStyle = MaterialSkin.Controls.MaterialForm.FormStyles.ActionBar_None; this.FormStyle = MaterialSkin.Controls.MaterialForm.FormStyles.ActionBar_None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "MainForm"; this.Name = "MainForm";
this.Padding = new System.Windows.Forms.Padding(3, 24, 3, 3); this.Padding = new System.Windows.Forms.Padding(3, 24, 3, 3);
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "MainForm"; this.Text = "MainForm";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.MainForm_FormClosed); this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.MainForm_FormClosed);

View File

@ -1521,7 +1521,33 @@ namespace PBAnaly.Module
System.Drawing.Point readLoction = ImageProcess.ConvertPictureBoxToReal( e.Location, imagePanel.image_pl); System.Drawing.Point readLoction = ImageProcess.ConvertPictureBoxToReal( e.Location, imagePanel.image_pl);
if (e.Button == MouseButtons.Left) if (e.Button == MouseButtons.Left)
{ {
if (lineOn) if (IsPointInRectangles(readLoction, rectangles, out var cner, out var cr, out var index))
{
rectActiveCorner = cner;
if (rectActiveCorner != Corner.None)
{
isRecDragging = true;
recDragStart = readLoction;
rectOriginalRect = cr;
rectDragStartIndex = index;
}
}
else if (IsPointInCircle(readLoction, CircleAndInfoList, out var cner1, out var curRect, out var index1))
{
rectActiveCorner = cner1;
if (rectActiveCorner != Corner.None)
{
isCirDragging = true;
cirDragStart = readLoction;
cireOriginalCire = curRect;
circleCenter = curRect.center;
circleRadio = curRect.Radius;
cirDragStartIndex = index1;
}
}
else if (lineOn)
{ {
drawLine = true; drawLine = true;
startPoint = readLoction; startPoint = readLoction;
@ -1569,32 +1595,8 @@ namespace PBAnaly.Module
isEndCircleDragged = true; isEndCircleDragged = true;
} }
else if (IsPointInCircle(readLoction, CircleAndInfoList, out var cner1, out var curRect, out var index1))
{
rectActiveCorner = cner1;
if (rectActiveCorner != Corner.None)
{
isCirDragging = true;
cirDragStart = readLoction;
cireOriginalCire = curRect;
circleCenter = curRect.center;
circleRadio = curRect.Radius;
cirDragStartIndex = index1;
}
}
else if (IsPointInRectangles(readLoction, rectangles, out var cner, out var cr, out var index))
{
rectActiveCorner = cner;
if (rectActiveCorner != Corner.None)
{
isRecDragging = true;
recDragStart = readLoction;
rectOriginalRect = cr;
rectDragStartIndex = index;
}
}
} }
else if (e.Button == MouseButtons.Right) else if (e.Button == MouseButtons.Right)
{ {