I have been poking around the GridControl settings too many hours know and probably gone blind...
I''m not able to find the setting where I:
1. Can turn on/off grid lines in the header
2. Adjust the color in the grid lines (when turned on)
Best regards,
Geir
AD
Administrator
Syncfusion Team
August 19, 2005 12:36 PM UTC
Two things that make headers special and so required special code to handle.
One is that if you are using themed headers, then the header are drawn using the theme from your OS, and so you have no control over colors or lines or anything.
The second is that the default headers take their style objects from case styles, grid.BaseStylesMap["Column Header"].StyleInfo. So, to change the styles of headers, you should change this style object.
So, for example, grid.BaseStylesMap["Column Header"].StyleInfo.ThemesEnabled = false will turn off themed drawing for the headers and allow themes to be used elsewhere in teh grid.
By default, a header uses style.CellType = "Header". With this celltyle, the raised appearance is done directly in the renderer and this is what gives the headers lines.
Try this code.
GridStyleInfo style = this.gridControl1.BaseStylesMap["Column Header"].StyleInfo;
style.CellType = "Static";
style.BackColor = Color.Red;
The "Row Header" base style controls the look of teh row headers, and the "Header" base style controls the top-left cell.
AD
Administrator
Syncfusion Team
August 19, 2005 12:46 PM UTC
This KB may be helpful.
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=57
To color a border, use:
style.Borders.Right = new GridBorder(GridBorderStyle.Solid, Color.Blue);
AD
Administrator
Syncfusion Team
August 23, 2005 11:12 AM UTC
Great stuff Clay, works like a charm!
One final follow up, when selecting a cell, i get a borders around the cell, do you have a tip on how to remove this border?
Best regards,
Geir
AD
Administrator
Syncfusion Team
August 23, 2005 11:29 AM UTC
If you never want to see the border, try settting:
grid.ShowCurrentCellBorderBehavior = GridShowCurrentCellBorder.HideAlways;
AD
Administrator
Syncfusion Team
August 23, 2005 03:23 PM UTC
Superb!
Best regards,
Geir