diff --git a/Windows/CS/Framework4.0/Toprie/Toprie/Setting.cs b/Windows/CS/Framework4.0/Toprie/Toprie/Setting.cs index 2f6c683..3b77cd7 100644 --- a/Windows/CS/Framework4.0/Toprie/Toprie/Setting.cs +++ b/Windows/CS/Framework4.0/Toprie/Toprie/Setting.cs @@ -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); }