困擾我好幾天的一個問題、今天終於解決了.....................
GridControl的可以設置FocusedRow的前景色和背景色、但是由於前景色已經動態生成、所以不想被覆蓋,英文大致爲這樣描述
by default the grid changes the cell's ForeColor when the row is focused and painted with a different background (AllowCellFocus turned off). How can I have the focused row still show the original ForeColors of all the cells in the row and not overpaint it with a specific ForeColor for focused rows?
If I do that I can't highlight a focused row with a background color anymore. I want to still be able to change the background on row
focus but I want the fore colors to remain the same as in the unfocused cells.
大致就是:改變FocusedRow的背景色,但是不改變前景色
兩步即可:
1、EnableAppearanceFocusedCell = False, EnableAppearanceFocusedRow = False
2、在代碼裏面給FocusedRow你想要的背景色、
private void gdvMarket_RowCellStyle(object sender, RowCellStyleEventArgs e)
{
if (e.RowHandle == gdvMarket.FocusedRowHandle)
{
e.Appearance.BackColor=Color.CadetBlue;
;
}
}