困扰我好几天的一个问题、今天终于解决了.....................
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;
;
}
}