将温差图例表编辑触发方式从单击改为双击

This commit is contained in:
zqm
2025-11-10 10:38:57 +08:00
parent c425078c81
commit 79694cc033

View File

@@ -132,6 +132,8 @@ namespace JoyD.Windows.CS
dataGridViewTempDiff.CellFormatting += new DataGridViewCellFormattingEventHandler(DataGridViewTempDiff_CellFormatting);
// 添加编辑控件显示事件用于设置编辑控件属性
dataGridViewTempDiff.EditingControlShowing += new DataGridViewEditingControlShowingEventHandler(DataGridViewTempDiff_EditingControlShowing);
// 添加单元格双击事件用于触发编辑模式
dataGridViewTempDiff.CellDoubleClick += new DataGridViewCellEventHandler(DataGridViewTempDiff_CellDoubleClick);
// 添加一些示例数据
AddSampleTempDiffData();
@@ -312,7 +314,7 @@ namespace JoyD.Windows.CS
{
if (e.RowIndex >= 0 && e.RowIndex < tempDiffData.Count)
{
// 处理颜色列点击
// 处理颜色列点击
if (e.ColumnIndex == dataGridViewTempDiff.Columns["colorColumn"].Index)
{
using (ColorDialog colorDialog = new ColorDialog())
@@ -329,8 +331,16 @@ namespace JoyD.Windows.CS
}
}
}
// 处理温差值列点击 - 当点击温差值列时,启动编辑模式
else if (e.ColumnIndex == dataGridViewTempDiff.Columns["tempDiffValue"].Index)
// 温差值列点击不再直接进入编辑模式,改为双击进入
}
}
private void DataGridViewTempDiff_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex >= 0 && e.RowIndex < tempDiffData.Count)
{
// 处理温差值列双击 - 双击时启动编辑模式
if (e.ColumnIndex == dataGridViewTempDiff.Columns["tempDiffValue"].Index)
{
dataGridViewTempDiff.BeginEdit(true);
}