我在Winform应用程序(c#)中有一个GridView
和GridControl
,并且在GridView
中有几列,我想设置标题列的背景。我可以做到,但是它将所有列更改为相同的颜色。我使用了该代码:
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;
此代码将所有列标题更改为白色。但是我想将第一列更改为白色,第二列更改为红色,以此类推。我该怎么做?
最佳答案
如果要将第一列更改为白色,将第二列更改为红色,请进行更改。
这是示例:
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.
关于c# - Devexpress列标题颜色(每列颜色不同),WinForm C#,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34398669/