如何给GridView标题加颜色 [英] how to give color to gridview caption

查看:173
本文介绍了如何给GridView标题加颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个gridview.在那个gridview中,我想给标题加上颜色.

Gridview如下

学生详细信息(Gridview标题)
研究了studname课程
1拉杰MFA
2拉梅什EFA
3 Vignesh SSO
4 Ram RSSO
5 Sudha ERS ​​

我想给彩色Gridview标题(学生详细信息).

为此我该怎么办.

问候,
Narasiman P.

I have one gridview. in that gridview i want to give color to caption.

Gridview as follows

Student details(Gridview Caption)
studid studname course
1 Raj MFA
2 Ramesh EFA
3 Vignesh SSO
4 Ram RSSO
5 Sudha ERS

I want to give color Gridview caption(Student details).

for that how can i do.

Regards,
Narasiman P.

推荐答案

使用Microsoft产品进行开发的妙处在于使用Intellisense.这应该是可以通过四处查找而很容易找到的东西.

您可以使用grid.HeaderRow属性访问网格标题行. ^ ]

设置行的ForeColor属性. https://msdn.microsoft.com /en-us/library/system.web.ui.webcontrols.gridviewrow(v=vs.110).aspx [
The great thing about developing with Microsoft products is using Intellisense. This should be the kind of thing that you can find pretty easily by poking around.

You can get to the Grid''s header row by using the grid.HeaderRow property.https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.headerrow(v=vs.110).aspx[^]

Set the row''s ForeColor property. https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridviewrow(v=vs.110).aspx[^]


此可能会帮助您:
固定标题的网格视图 [
This might help you :
Gridview with Fixed Header[^]


这是一个两步过程:
1.首先对datagridview使用ColumnHeadersDefaultCellStyle.BackColor属性来设置标题backcolor.
< grid> .ColumnHeadersDefaultCellStyle.BackColor =颜色.<任何颜色="> ;;
2.然后需要将EnableHeadersVisualStyles属性设置为false.
< grid> .EnableHeadersVisualStyles = false;

希望对您有所帮助.
It''s a two step process :
1. First use ColumnHeadersDefaultCellStyle.BackColor property for datagridview to set header backcolor.
<grid>.ColumnHeadersDefaultCellStyle.BackColor = Color.<any color="">;
2. Then need to set EnableHeadersVisualStyles property to false.
<grid>.EnableHeadersVisualStyles = false;

Hope it helped.


这篇关于如何给GridView标题加颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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