是否可以更改DGV控制的第-1列的背景颜色 [英] Is it possible to change the background color of column -1 of DGV control

查看:75
本文介绍了是否可以更改DGV控制的第-1列的背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

DataGridView的行标题列的颜色(我相信它是列索引-1)可以在代码或属性设置中更改为红色或绿色或其他颜色吗?如果是这样的话?



Can the color of the row header column of DataGridView (I believe it is column index -1) be changed in code or property settings to red or green or some other color? If so how?

[edit: added WinForm-Tag /manchanx]

推荐答案

解决方案是添加一行代码。 (我将它添加到Sub Form1_Load。)

DataGridView1.EnableHeadersVisualStyles = False。使用这个添加的代码,属性项RowHeadersDefaultCellStyle将响应BackColor和SelectionBackColor中的颜色选择,这正是我所寻找的。这实际上是DataGridView中的-1列。
The solution is to add one line of code. (I added it to Sub Form1_Load.)
DataGridView1.EnableHeadersVisualStyles = False. With this added code the properties item RowHeadersDefaultCellStyle will respond to the selection of color in BackColor and SelectionBackColor which is what I was looking for. This in indeed the -1 column in DataGridView.


这篇关于是否可以更改DGV控制的第-1列的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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