/// <summary> /// 事件响应函数---双击单元格中的任意位置时发生 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ChannelsConfigDataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 5 && e.RowIndex > -1) { ColorChoiceDialog.Color = ChannelsConfigDataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor; DialogResult dr = ColorChoiceDialog.ShowDialog(); if (dr == DialogResult.OK) { ChannelsConfigDataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = ColorChoiceDialog.Color; //Color.FromArgb(CommonClass.listDIC[LayerComboBox1.SelectedIndex].listCC[i].Color); ChannelsConfigDataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = ""; ApplyCurrentConfig(); } } if (ChannelsConfigDataGridView1.SelectedRows.Count > 0) { //是否显示,包含偏移,上下反转 if (e.ColumnIndex == 6 || e.ColumnIndex == 10 || e.ColumnIndex == 11) { bool isCheck = (bool)ChannelsConfigDataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value; ChannelsConfigDataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = !isCheck; ApplyCurrentConfig(); if (e.ColumnIndex == 6) { waveformMaker.AutoArrange(); } } } }
/// <summary> /// 事件响应函数---双击单元格中的任意位置时发生 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ChannelsConfigDataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 5 && e.RowIndex > -1) { ColorChoiceDialog.Color = ChannelsConfigDataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor; DialogResult dr = ColorChoiceDialog.ShowDialog(); if (dr == DialogResult.OK) { ChannelsConfigDataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = ColorChoiceDialog.Color; //Color.FromArgb(CommonClass.listDIC[LayerComboBox1.SelectedIndex].listCC[i].Color); ChannelsConfigDataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = ""; } } }
private void ColorChoiceButton_Click(object sender, EventArgs e) { DialogResult dr = ColorChoiceDialog.ShowDialog(); }