Try this.
Select the datagridview and go to Events in the properties window.
double click the ColumnHeaderMouseDoubleClick event.
Then in code:
private void dataGridView1_ColumnHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
{
r7.checked == true;
int i= e.ColumnIndex;
}