You need to select only the row that has been double clicked. Something along these lines.
private void dataGridView2_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
{
var selectedRow = dataGridView2.Rows[e.RowIndex];
string msg = selectedRow.DefaultCellStyle.ForeColor == Color.Black ? "Black" : "Red";
MessageBox.Show(msg);
}