473,322 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

DataGridView Background

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
Nov 24 '06 #1
1 13578
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 BackgroundColor2
{
get { return backcolor2; }
set { backcolor2 = value; }
}

private System.Drawing.Drawing2D.LinearGradientMode gradientMode;

public System.Drawing.Drawing2D.LinearGradientMode GradientMode
{
get { return gradientMode; }
set { gradientMode = value; }
}

protected override void PaintBackground(Graphics graphics, Rectangle
clipBounds, Rectangle gridBounds)
{
graphics.FillRectangle(new
System.Drawing.Drawing2D.LinearGradientBrush(gridB ounds,
this.BackgroundColor, this.BackgroundColor2, gradientMode), gridBounds);
if (backgroundImage != null)
graphics.DrawImageUnscaled(backgroundImage, 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
Nov 24 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: dgk | last post by:
Is there a way to change the foreground or background color of a single cell in an unbound datagridview?
0
by: sunny076 | last post by:
Hi, I am having difficulties creating a derived class for DisabledDataGridViewTextBoxColumn and cell when the VisualStyle is not supported. Basically I am down to either using ControlPaint or...
6
by: martin1 | last post by:
Hi, all, Is there any way to change DataGridView row color based on different row data? for example, if row data in first column = 1, it is yellow, if it is 2, it is blue, if 3 it is white. That...
7
by: Mitchell S. Honnert | last post by:
Is there an equivalent of the DataGrid's DataGridTableStyle for the DataGridView? If not, is there an easy way to duplicate the DataGridTableStyle's functionality for the DataGridView? Here's...
0
by: owais_zahid | last post by:
hi guy! i m using visula studio 2005 and developing windows application. I came across a problem while setting the background color of "DataGridView" to transparent. Plz, help me on tht one.
1
by: Jeff | last post by:
..NET 2.0 On my form I have a DataGridView, I want the rows in this DataGridView to have different background colors. The data presented on the rows are of 3 types: A, B or C.... For the user to...
0
by: =?Utf-8?B?Y2FsZGVyYXJh?= | last post by:
Dear all, I have a datagridview whcih is bind to a database. I would like that the row backround color is red for all records where the content of the column x is 2. What is the way to do...
0
by: Przemek | last post by:
Hello, I have a little problem. I use flat style for Buttons on DataGridView and every looks fine (non 3d buttons) but when I move mouse over DataGridView Button then background of this button...
1
by: PeterSchwennesen | last post by:
I like to add a gradient brush to each row of my datagridview. I like to change the gradient colors for each row independently depending of some cell values in the row. I know how to add a solid...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.