如何仅更改C#.Net中的DataGridView RowHeader的网格颜色(Windows应用程序) [英] How to change only DataGridView RowHeader's Grid Colour in C#.Net(Windows Application)

查看:98
本文介绍了如何仅更改C#.Net中的DataGridView RowHeader的网格颜色(Windows应用程序)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用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屋!

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