473,396 Members | 1,766 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,396 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 13596
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.