[C#-Winform] dataGridview依條件改變內容,Cell 異動 (使用 DataBindingComplete) ,Devexpress的gridView (使用 RowCellStyle)

dataGridview依條件改變內容,Cell 異動 (使用 DataBindingComplete) ,Devexpress的gridView  (使用 RowCellStyle) 

在實作dataGridview 會依條件改變內容,可以使用事件DataBindingComplete 來實現

ex:Cell 異動數值或顏色

如果直接在click 事件做異動的時候,可能會發現Cell 沒有如預期的異動顏色

這個時候可以使用 DataBindingComplete來實現!!!!!

 

private void dataGridView1_DataBindingComplete(object sender,DataGridViewBindingCompleteEventArgs e)
{
    //............
}

來源:官方網站

 

如果在Devexpress 元件使用gridView  ,則可以使用RowCellStyle 來完成

private void gridView1_RowCellStyle(object sender, RowCellStyleEventArgs e)
{
    //............
}

來源:Devexpress官方網站

 


與每個人,一起分享所學到,所用到的,

若有錯誤,請您不吝指教,謝謝大家。