修改BtnDeleteTempDiff_Click方法,在删除温差图例时将对应颜色的像素改为透明色

This commit is contained in:
zqm
2025-11-11 10:28:39 +08:00
parent cee73c3751
commit a8da65fd1a

View File

@@ -1224,6 +1224,8 @@ namespace JoyD.Windows.CS
{ {
try try
{ {
Color colorToRemove = Color.Empty;
// 检查是否有选中的行 // 检查是否有选中的行
if (dataGridViewTempDiff.SelectedRows.Count > 0) if (dataGridViewTempDiff.SelectedRows.Count > 0)
{ {
@@ -1233,6 +1235,9 @@ namespace JoyD.Windows.CS
// 从数据集合中删除该行数据 // 从数据集合中删除该行数据
if (selectedRowIndex >= 0 && selectedRowIndex < tempDiffData.Count) if (selectedRowIndex >= 0 && selectedRowIndex < tempDiffData.Count)
{ {
// 获取要删除的图例对应的颜色
colorToRemove = (Color)tempDiffData[selectedRowIndex]["color"];
tempDiffData.RemoveAt(selectedRowIndex); tempDiffData.RemoveAt(selectedRowIndex);
// 从DataGridView中删除该行 // 从DataGridView中删除该行
dataGridViewTempDiff.Rows.RemoveAt(selectedRowIndex); dataGridViewTempDiff.Rows.RemoveAt(selectedRowIndex);
@@ -1247,11 +1252,21 @@ namespace JoyD.Windows.CS
// 从数据集合中删除该行数据 // 从数据集合中删除该行数据
if (currentRowIndex >= 0 && currentRowIndex < tempDiffData.Count) if (currentRowIndex >= 0 && currentRowIndex < tempDiffData.Count)
{ {
// 获取要删除的图例对应的颜色
colorToRemove = (Color)tempDiffData[currentRowIndex]["color"];
tempDiffData.RemoveAt(currentRowIndex); tempDiffData.RemoveAt(currentRowIndex);
// 从DataGridView中删除该行 // 从DataGridView中删除该行
dataGridViewTempDiff.Rows.RemoveAt(currentRowIndex); dataGridViewTempDiff.Rows.RemoveAt(currentRowIndex);
} }
} }
// 将温差层中对应颜色的像素改为透明色
if (colorToRemove != Color.Empty && _tempDiffOverlayImage != null)
{
UpdateTempDiffOverlayPixelsColor(colorToRemove, Color.Transparent);
picBoxTemp.Invalidate(); // 刷新显示
}
} }
catch (Exception ex) catch (Exception ex)
{ {