如何仅更改C#.Net中的DataGridView RowHeader的网格颜色(Windows应用程序) [英] How to change only DataGridView RowHeader's Grid Colour in C#.Net(Windows Application)
问题描述
我用DataGridView控件创建了一个窗体,并将DataGridView控件的网格颜色更改为黑色.
我想将其他网格颜色设置为仅RowHeader.
怎么做?
请帮忙.
I have created one Form with DataGridView control and have changed DataGridView control''s grid colour to black.
I want to set other Grid colour to only RowHeader.
How to do it?
Please Help.
推荐答案
啊!这更有意义!
设置单个单元格颜色:
Ah! That makes a bit more sense!
Set an individual Cell colour:
myDataGridView[col, row].Style.BackColor = Color.Red;
设置标题背景颜色:
To set the header background colour:
myDataGridView.EnableHeadersVisualStyles = false;
myDataGridView.Columns[col].HeaderCell.Style.BackColor = Color.Green;
将EnableHeadersVisualStyles
设置为false会导致其他更改,您将不得不手动对其进行覆盖-设置时您会明白我的意思-是否值得付出努力取决于您!基本上,要更改颜色,您必须将显示控件带走,然后自己完成所有操作...
Setting EnableHeadersVisualStyles
to false will cause other changes which you will have to override manually - you will see what I mean when you set it - it''s up to you whether it is worth the effort! Basically, in order to change the colour, you have to take display control away and do it all yourself...
希望 ^ ]可能会为您提供帮助.
Hope this[^] might help you.
希望此 [
Hope this[^] might help you.
这篇关于如何仅更改C#.Net中的DataGridView RowHeader的网格颜色(Windows应用程序)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!