| True DBGrid for WinForms Task-Based Help > Setting the Grid's Appearance > Placing an Image in a Column Header |
To place an image in a column header, set the ForegroundImage and ForeGroundPicturePosition properties. These properties can be set either in the designer or in code.
To place an image in a column header using the C1TrueDBGrid Tasks menu:



Alternatively, an image can also be placed in the column header at design time using the C1DisplayColumn Collection Editor.


Add the following code to the Form_Load event:
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Dim bmp As New Bitmap("c:\sort.bmp")
|
|
To write code in C#
| C# |
Copy Code
|
|---|---|
Bitmap bmp = new Bitmap("c:\\sort.bmp");
|
|
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Me.C1TrueDBGrid1.Splits(0).DisplayColumns(1).HeadingStyle.ForegroundImage = bmp Me.C1TrueDBGrid1.Splits(0).DisplayColumns(1).HeadingStyle.ForeGroundPicturePosition = C1.Win.C1TrueDBGrid.ForeGroundPicturePositionEnum.LeftOfText |
|
To write code in C#
| C# |
Copy Code
|
|---|---|
this.c1TrueDBGrid1.Splits[0].DisplayColumns[1].HeadingStyle.ForegroundImage = bmp; this.c1TrueDBGrid1.Splits[0].DisplayColumns[1].HeadingStyle.ForeGroundPicturePosition = C1.Win.C1TrueDBGrid.ForeGroundPicturePositionEnum.LeftOfText; |
|
In this example, the image appears to the left of the text in the header of the Last column: