您的位置:首页 > 其它

DataGridView 选中一行不变色

2015-12-01 16:02 260 查看
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);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: