Home Forums WinForms controls Xceed Grid for WinForms Set background image for columnheader from code Reply To: Set background image for columnheader from code

User (Old forums)
Member
Post count: 23064

This should work fine, except that there is something a bit awkward in your code. If ConnectorGrid is your GridControl, ConnectorGrid.columnManagerRowX should not compile, since the only way to access the ColumnManagerRow through the GridControl is through the FixedHeaderRows collection, or, of course through the ColumnManagerRow instance itself.

e.g. :

//Through the GridControl
//the index in the FixedHeaderRows will depend on the other rows it may contain, like a GroupByRow
( ( ColumnManagerRow ) gridControl1.FixedHeaderRows[ 1 ]).Cells[ 0 ].BackgroundImage = new Bitmap( @”D:\Test.ico” );
( ( ColumnManagerRow ) gridControl1.FixedHeaderRows[ 1 ]).Cells[ 0 ].BackgroundImageAlignment = ContentAlignment.MiddleLeft;

//Through the instance itself
columnManagerRow1.Cells[ 0 ].BackgroundImage = new Bitmap( @”D:\Test.ico” );
columnManagerRow1.Cells[ 0 ].BackgroundImageAlignment = ContentAlignment.MiddleLeft;

What do you mean by “avoid custom painting”?

Imported from legacy forums. Posted by André (had 297 views)