最簡單按下Enter時判斷datagridView單元格資料是否改變方法
object oldValue = null;
private void DataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
{
oldValue = dataGridView1.CurrentCell.Value;
}
private void DataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
if (oldValue != dataGridView1.CurrentCell.Value)
{
dataGridView1.CurrentCell.Style.BackColor = Color.Pink;
}
}