Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > WinForms DataGridView flickering on scroll
 

WinForms DataGridView flickering on scroll

Using a datagridview in a winforms app, tied to a bindingsource. Not that many records, say 20-30, and about 15 columns. When I use the scrollbars, the entire screen starts flickering, including other apps. I'm not even refreshing the datasource when the flicker occurs. Is this a bug in the datagridview? I could almost accept the issue if it was just the app that was running, but it makes everything on the screen flicker.

As a side note, it seems to be worse when scrolling horizontally. I also reviewed all of the code to see if there were event handlers on the datagridview that could be slowing the refresh down, but I can't find anything that could cause the problem.
bpeikes  Wednesday, August 26, 2009 4:48 PM
We found a solution. We derive from DataGridView a new class called DataGridViewDoubleBuffer and in the constructor, set the DoubleBufffer property to True. That fixed the problem, why DoubleBuffer is a protected member, I have no idea. Example:

class DataGridViewDoubleBuffer
{
public DataGridViewDoubleBuffer()
{
DoubleBuffered = true;
}
}
  • Marked As Answer bybpeikes Thursday, August 27, 2009 3:13 PM
  •  
bpeikes  Thursday, August 27, 2009 3:13 PM
Hello,

I performed a test on my side, however I cannot reproduce this issue on Visual Studio 2008 SP1. To isolate the issue, could you please try the following things and paste the result here.

1. Try to create a new Windows Form project and bind the bindingsource to DataGridView to see if the issue still happens. This can help us to isolate if the issue is specific to the project.

2. Try to run the application on another machine to see the issue still happens. This can help to see if the issue is related to the environment.

I would also appreciate that if you could provide a reproducible project so that we can investigate the issue locally. It is not necessary that you send out the whole of your project. We just need a simplest sample to reproduce the problem. You can remove any confidential information or business details from it.

Thanks,
Rong-Chun Zhang
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Rong-Chun Zhang  Thursday, August 27, 2009 9:10 AM
We found a solution. We derive from DataGridView a new class called DataGridViewDoubleBuffer and in the constructor, set the DoubleBufffer property to True. That fixed the problem, why DoubleBuffer is a protected member, I have no idea. Example:

class DataGridViewDoubleBuffer
{
public DataGridViewDoubleBuffer()
{
DoubleBuffered = true;
}
}
  • Marked As Answer bybpeikes Thursday, August 27, 2009 3:13 PM
  •  
bpeikes  Thursday, August 27, 2009 3:13 PM

You can use google to search for other answers

Custom Search

More Threads

• binding combo box into datagridview
• Bind data to the TreeView Control
• Datagrid date update problem
• DataGridView Row Header Mouse Double Click Event, Visual Studio 2005
• How to access DataSource's DataSet
• Multicolumn Combobox in the DataGridView
• Copy-Paste option in DataGridView
• ComboBox Data Binding Question
• datagridview scrolling issues...
• Paging support when bind Formview with Arraylist