Add Image on DatagridView cell Header

Datagrid view does not have any property by which we can add an Image on DataGrid View Header.

But we can add Image on data grid view programetically.

We will use CellPainting Event of data grid view to add the image.

Declare an Image vriable

Dim InfoIcon As Image = Image.FromFile("C:\AddEmoticons04247.gif")

 'Replace C:\AddEmoticons04247.gif with your Image File Path.

Use the following code to Add image on Header.

If e.RowIndex = -1 AndAlso e.ColumnIndex = MyDataGridView.Columns.Count - 1 Then

                e.Paint(e.CellBounds, DataGridViewPaintParts.All And Not DataGridViewPaintParts.ContentForeground)

                e.Graphics.DrawImage(InfoIcon, e.CellBounds)

                e.Handled = True

            End If