2012-05-29 34 views

回答

1

挂钩的CellDoubleClick事件的数据网格。 DataGridViewCellEventArgs包含被点击的行和列。如果行索引为-1,则单击标题。

private void MyDataGridView_CellDoubleClick(object sender, 
    DataGridViewCellEventArgs e) 
{ 
    if (e.RowIndex < 0) 
    { 
     // header was clicked 
    } 
    else 
    { 
     // data row was clicked, can access the row contents like this 
     var row = MyDataGridView.Rows[e.RowIndex]; 
     var cell = row[0]; 
    } 
} 
0
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) 
{ 
    foreach(var item in dataGridView1.SelectedRows) 
    { 

    } 
}