473,404 Members | 2,174 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,404 software developers and data experts.

DataGridView, add unique gradient to each Row

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 filling the datagridview, I want to step trough each row, find my key values, decide the gradient colors and then add the gradient to the row.

I like to do something similar to what I now do with a background color:

Expand|Select|Wrap|Line Numbers
  1. For Each R As DataGridViewRow In DGV.Rows
  2.     Dim CS As New DataGridViewCellStyle
  3.     Select Case i
  4.          Case 1 : CS.BackColor = Color.Yellow
  5.          Case 2 : CS.BackColor = Color.Blue
  6.     End Select
  7.     R.DefaultCellStyle = CS
  8. Next
Is this possible? And How do you do this?
I am using VB.NET and VS 2008 and 2010

Peter Schwennesen
Apr 22 '10 #1
1 3505
I think you need to create a derived control from the datagridview, and paint this yourself. Perhaps someone else has specifics, but it may give you an idea. Also - search for "custom draw" and "owner drawn" in the contxt of the DataGridView
Apr 23 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Crirus | last post by:
The main ideea: I havea 513x513 array of values....I draw a sort of map using that values for colors... so I have a realistic lanscape (map). I want to zoom about 60 times that map...and the...
2
by: Dean Slindee | last post by:
It appears that I have two routines that don't play well together! First routine: a form's background is shaded with a gradient color. Second routine: then, the background of all labels on the...
11
by: Maximus | last post by:
Hi all, Has anyone been able to reterive the gradient selection colors used in outlook 2003? Basically, I have a grid showing a list of records and my client wants the selected row to have the...
4
by: Steve Teeples | last post by:
I have a form with two DataGridView controls. The form has linked to it an Access database with just two tables. The second table contains unique "child" data having a one-to-one relationship...
4
by: Jon Slaughter | last post by:
I'm drawing a linear gradient and its very "banded". The colors are far enough part that it should be plenty smooth enough but I always get the same number of bands regardless. I've tried to set...
1
by: Diogo Alves - Software Developer | last post by:
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...
0
by: Mike | last post by:
Hey everyone... I've got three problems with a custom DataGridView column I've built following the "How To: Host Controls in Windows Forms DataGridView Cells" article. The base editing control...
7
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is...
5
by: Bob Altman | last post by:
Hi all, Here's another rank beginner question. What is the standard way to fill a client-side table cell with a horizontal gradient background? TIA - Bob
6
by: Miro | last post by:
Sorry for the cross post. I am stuck. I have a datagridview for poker rounds. Basically there are 3 columns in this datagridview. "Round" "SmallBlind" "BigBlind" I have an issue when I tab...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
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
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...
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.