private void dataGridView1_[color=red]CellDoubleClick[/color](object sender, DataGridViewCellEventArgs e) { if ([color=red]e.RowIndex > -1 && e.ColumnIndex > -1[/color])//双击表头或列头时不起作用 { MessageBox.Show("ok"); } }