473,614 Members | 2,361 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 13636
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
Nov 24 '06 #2

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

Similar topics

11
109591
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
2488
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 Graphics to achieve this. But with Graphics, I am not sure how I can make them diabled. Below are my codes:
6
24768
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 means how to loop DataGridData to get row data, then based on the different data to change row background color? Thanks in advance!
7
12589
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 the background for my question... Before I switched my application over to the Fx 2.0, I used a DataGrid to display my data. I would store different DataGridTableStyles (each one with a custom set of columns) in the DataGrid.TableStyles property...
0
3247
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
1382
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 easy see what type the data on each row have I want to individually set the background color of each row... For example rows with data of type A gets a light-blue background color, B gets light green and C get a light red color... Is this...
0
1431
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 that ? thnaks for help regards
0
1579
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 are darker and when I down left button of my mouse over this DataGridView Button then background of this button are lighter. I want to see one color (ex. "Control") when I move over, click or leave this button but I don't know how to do this.
1
3512
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 background color to each, cell, row, column etc. but I do not know how to add a gradient brush to each row individualy. I need to fill the datagridview with values, the datagridview is disconnected from any database or other data source. After...
0
8124
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8272
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7050
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6087
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5538
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4049
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4119
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2565
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1712
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.