小智 6
使用 ObjectListView,您可以使用 HeaderFormatStyle 类更改标题的背景颜色。
这是一个简短的示例(使用深蓝色作为背景色和灰色作为文本将所有标题更改为相同的样式):
using System;
//...
using BrightIdeasSoftware;
//...
private void adjustMyObjectListViewHeader()
{
foreach (OLVColumn item in olv.Columns)
{
var headerstyle = new HeaderFormatStyle();
headerstyle.SetBackColor(Color.DarkBlue);
headerstyle.SetForeColor(Color.SlateGray);
item.HeaderFormatStyle = headerstyle;
}
}
Run Code Online (Sandbox Code Playgroud)
olv 是 ObjectListView 对象
可以在 ObjectListView Cookbook 中找到详细信息:http : //objectlistview.sourceforge.net/cs/recipes.html#how-do-i-change-the-font-or-color-of-the-column-headers
希望这可以帮助...
| 归档时间: |
|
| 查看次数: |
1668 次 |
| 最近记录: |