Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

painting individual datagridview cells in visual c#

Posted on 2006-10-21
2
Medium Priority
?
3,380 Views
Last Modified: 2008-01-09
i am creating a datagridview that is populated like this:

DataGridViewRow Row = new DataGridViewRow();
Row = new DataGridViewRow();

DataGridViewCell[] Cells = new DataGridViewCell[2];

Cells[0] = new DataGridViewTextBoxCell();
Cells[0].Value = " ";
Cells[1].Style.BackColor = Color.FromArgb(0, 0, 0);
Cells[1] = new DataGridViewTextBoxCell();
Cells[1].Value = " ";
Cells[1].Style.BackColor = Color.FromArgb(0, 0, 0);

Row.Cells.AddRange(Cells);
dataGridView1.Rows.Add(Row);

and later in the code, this datagridview gets populated with data. when the cell gets populated with data, the cell will change color. when there is no data for the cell, it will revert back to the previous color.

the problem i am facing is there are 1000 rows in this datagridview, and when i change the color on some of the cells (reverting the color back) it seems to be painting the whole datagridview every time...i can see the whole datagridview flicker when it updates.

so my question is:
how can i JUST paint the individual cell and not the whole datagridview when one cell changes color?

thanks in advance.
0
Comment
Question by:jumpmanjay
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
e1v earned 2000 total points
ID: 17787092
You could try do set DoubleBuffered true for your dataGridView, but since it's a protected property you have derive from datagridview and use the derived datagridview.

public class CustomDataGridView : DataGridView
{
  public CustomDataGridView() : base()
  {
    base.DoubleBuffered = true;
  }
}

This will reduce flickering a lot, but it's not answering your question since the whole visible datagridview still updates (noticeable on slow systems).
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question