The below class in a DataGridView that has a background image propert and a
backcolor2 and gradientmode. It draws the background and image in the
Paintbackgroun method.
HTH
Ciaran O'Donnell
http://wannabedeveloper.spaces.live.com/
public class DGV : DataGridView
{
private Image backgroundImage ;
public Image BackgroundImage
{
get { return backgroundImage ; }
set { backgroundImage = value; }
}
private Color backcolor2;
public Color BackgroundColor 2
{
get { return backcolor2; }
set { backcolor2 = value; }
}
private System.Drawing. Drawing2D.Linea rGradientMode gradientMode;
public System.Drawing. Drawing2D.Linea rGradientMode GradientMode
{
get { return gradientMode; }
set { gradientMode = value; }
}
protected override void PaintBackground (Graphics graphics, Rectangle
clipBounds, Rectangle gridBounds)
{
graphics.FillRe ctangle(new
System.Drawing. Drawing2D.Linea rGradientBrush( gridBounds,
this.Background Color, this.Background Color2, gradientMode), gridBounds);
if (backgroundImag e != null)
graphics.DrawIm ageUnscaled(bac kgroundImage, gridBounds);
}
}
"Diogo Alves - Software Developer" wrote:
Greetings,
I've been trying to put an image on the background of a datagrid,
I used the overriten property BackgroundImage , but it was useless (maybe I'm
missing something).
Could someone help me with this... I want to put a gradient on the
background of the datagrid... but can't find any way to do this....
Thanks in Advance