private void textGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
e.CellStyle.SelectionForeColor = e.CellStyle.ForeColor;
e.CellStyle.SelectionBackColor = e.CellStyle.BackColor;
}
/// <summary>
/// 选择行时保留文本颜色
/// </summary>
/// <param name="e"></param>
protected override void OnCellFormatting(DataGridViewCellFormattingEventArgs e)
{
e.CellStyle.SelectionForeColor = e.CellStyle.ForeColor;
base.OnCellFormatting(e);
}