How to include an icon in the column header of WinForms Grid?
Image index and list
When you use
the ImageIndex and ImageList properties to
set the icons, these properties only work for the TextBox and
Static cells. So, make your header cell as static and then set your ImageIndex.
For the DataBoundGrid, you have to use the PrepareViewStyleInfo to
set these properties.
GridControl:
private void Form1_Load(object sender, System.EventArgs e)
{
this.gridControl1[0,2].CellType = "Static";
this.gridControl1[0,2].Text = "B";
this.gridControl1[0,2].CellAppearance = GridCellAppearance.Raised;
this.gridControl1[0,2].ImageList = imageList;
this.gridControl1[0,2].ImageIndex = 1;
}Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.gridControl1(0,2).CellType = "Static"
Me.gridControl1(0,2).Text = "B"
Me.gridControl1(0,2).CellAppearance = GridCellAppearance.Raised
Me.gridControl1(0,2).ImageList = imageList
Me.gridControl1(0,2).ImageIndex = 1
End SubGridDataBoundGrid:
Refer to the following code example for setting the image in the header of the GridDataBoundGrid by using PrepareViewStyleInfo.
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)
{
if(e.RowIndex == 0 )
{
e.Style.CellType = "Static";
e.Style.CellAppearance = GridCellAppearance.Raised;
if(e.ColIndex == 1)
{
e.Style.ImageList = imageList;
e.Style.ImageIndex = 0;
}
if(e.ColIndex == 2)
{
e.Style.ImageList = imageList;
e.Style.ImageIndex = 1;
}
if(e.ColIndex == 3)
{
e.Style.ImageList = imageList;
e.Style.ImageIndex = 2;
}
}
}Private Sub gridDataBoundGrid1_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs) Handles gridDataBoundGrid1.PrepareViewStyleInfo
If e.RowIndex = 0 Then
e.Style.CellType = "Static"
e.Style.CellAppearance = GridCellAppearance.Raised
If e.ColIndex = 1 Then
e.Style.ImageList = imageList
e.Style.ImageIndex = 0
End If
If e.ColIndex = 2 Then
e.Style.ImageList = imageList
e.Style.ImageIndex = 1
End If
If e.ColIndex = 3 Then
e.Style.ImageList = imageList
e.Style.ImageIndex = 2
End If
End If
End SubThe following screenshots display the images in the header of the GridControl and GridDataBoundGrid.

Samples:
Conclusion
I hope you enjoyed learning about How to include an icon in the column header of the WinForms GridControl and GridDataBoundGrid.
You can refer to WinForms GridControl feature tour page to know about its other groundbreaking feature representations and WinForms GridControl documentation, and how to quickly get started for configuration specifications.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!