Devexpress列标题颜色(每列颜色不同),WinForm C# [英] Devexpress column header color (each column different color), winform c#

查看:84
本文介绍了Devexpress列标题颜色(每列颜色不同),WinForm C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在winform应用程序(c#)中有一个 GridView GridControl ,并且在<$ c中有几列$ c> GridView ,我想设置标题列的背景。我可以做到,但是它将所有列更改为相同的颜色。我使用了该代码:

I have a GridView and GridControl in winform app (c#) and I have several columns in GridView and I want to set background of header columns. I can do it but it changes all columns in same color. I used that code:

gridcntrActic.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Flat;
gridcntrActic.LookAndFeel.UseDefaultLookAndFeel = false; 
gridviewActiv.Appearance.HeaderPanel.Options.UseBackColor = true;
gridviewActiv.Appearance.HeaderPanel.BackColor = System.Drawing.Color.White;

此代码将所有列标题更改为白色。但是我想将第一列更改为白色,第二列更改为红色,以此类推。我该怎么做?

This code changes all column headers to white. But I want to change first column to white and second to red and so. How can I do it?

推荐答案

如果要将第一列更改为白色,将第二列更改为红色,请进行更改。

例如:

If you want to change first column to white and second to red, so change it.
Here is example:

gridcntrActic.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Flat;
gridcntrActic.LookAndFeel.UseDefaultLookAndFeel = false;

gridviewActiv.Columns[0].AppearanceHeader.Options.UseBackColor = true;
gridviewActiv.Columns[0].AppearanceHeader.BackColor = System.Drawing.Color.White;

gridviewActiv.Columns[1].AppearanceHeader.Options.UseBackColor = true;
gridviewActiv.Columns[1].AppearanceHeader.BackColor = System.Drawing.Color.Red;

//And so on.

这篇关于Devexpress列标题颜色(每列颜色不同),WinForm C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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