实现btnNewTempRegion按钮功能:移除所有已有测温区并清空叠加层图像

This commit is contained in:
zqm
2025-11-11 14:21:10 +08:00
parent b5cfa01c84
commit a1684422b1
2 changed files with 29 additions and 0 deletions

View File

@@ -145,6 +145,7 @@ namespace JoyD.Windows.CS
this.btnNewTempRegion.Size = new System.Drawing.Size(23, 4);
this.btnNewTempRegion.Text = "新建测温区";
this.btnNewTempRegion.ToolTipText = "新建测温区";
this.btnNewTempRegion.Click += new System.EventHandler(this.BtnNewTempRegion_Click);
//
// btnLoadTempRegion
//

View File

@@ -2999,6 +2999,34 @@ namespace JoyD.Windows.CS
}
}
/// <summary>
/// 新建测温区按钮点击事件
/// </summary>
private void BtnNewTempRegion_Click(object sender, EventArgs e)
{
try
{
// 移除所有已有的测温区列表
_drawnRectangles.Clear();
// 取消选中状态
_selectedRegionIndex = -1;
// 用透明色清空叠加层图像
CreateRectangleOverlayImage();
// 触发重绘
picBoxTemp.Invalidate();
// 更新按钮可见性,设置为就绪状态
UpdateButtonsVisibility(0);
}
catch (Exception ex)
{
Console.WriteLine("新建测温区失败: " + ex.Message);
}
}
/// <summary>
/// 删除按钮点击事件
/// </summary>