如何更改 datagridview 选定行的背景颜色? [英] How do I change the datagridview selected row background color?

查看:49
本文介绍了如何更改 datagridview 选定行的背景颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 C# windows 应用程序中更改 datagridview 选定行的背景颜色?

How do I change the datagridview selected row background color in C# windows applications?

推荐答案

来吧伙计...必须有一个简单的解决方案,终于有一个.

Come on man... there has to be a simple solution, and finally got one.

dataGridView1.DefaultCellStyle.SelectionBackColor = Color.Blue;
dataGridView1.DefaultCellStyle.SelectionForeColor = Color.Red;

这对我有用,没有复杂的代码,没有事件处理.我以前做过,但想不起来了,所以我认为发布它会在未来帮助他人和我:)

This worked for me, no complex codes, no event handling. I did it before but was not able to recall so thought posting it would help others and me in future :)

这篇关于如何更改 datagridview 选定行的背景颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆