Set Image as Background for DataGridView
How to show an image in the background for DataGridView

Introduction
I needed to set an image as the background of DataGridView
. I searched the Internet but could not find anything useful, so I did it myself. It is easy and small; I have tested it and it is working ok. Before you use it, please test it.
How To Do It
Just create a new class and inherit it from DataGridView
as follows:
Imports system.ComponentModel
Public Class usrDataGridView
Inherits Windows.Forms.DataGridView
Private m_Image As Drawing.Image
Public Sub New()
Me.m_Image = Drawing.Image.FromFile("c:\sisnetBG.jpg")
End Sub
Protected Overrides Sub PaintBackground(_
ByVal graphics As System.Drawing.Graphics, _
ByVal clipBounds As System.Drawing.Rectangle, _
ByVal gridBounds As System.Drawing.Rectangle)
MyBase.PaintBackground(graphics, clipBounds, gridBounds)
graphics.DrawImage(Me.m_Image, gridBounds)
End Sub
<description("set /> _
Public Property BackImage() As Drawing.Image
Get
Return Me.m_Image
End Get
Set(ByVal value As Drawing.Image)
Me.m_Image = value
End Set
End Property
End Class
History
- 14th February, 2007 -- Original version posted