Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've a problem i've been struggling with for some days.

I've got a DataGridView, and I'm using the RowPrePaint event to add a custom row by drawing a string and a background. So far,so good.

The problem comes when i use horizontal scrolling. Moving it to the right is not a problem, the string i draw just hides. But when i move it backwards, the string is not drawn or is partly drawn causing strange graphics artifacts.

I've solved it partly by subscribing to the scroll event and invalidating the grid when the scroll is horizontal and moving from right to left, but it's slow and cause some flickering.

Anyone knows how to solve this problem or where i could find some working example?

Thanks.
Posted
Updated 23-Jan-15 0:13am
v3
Comments
George Swan 23-Jan-15 9:16am    
Have you seen this article on how to reduce flickering? http://www.codeproject.com/Tips/390496/Reducing-flicker-blinking-in-DataGridView
Pikoh 26-Jan-15 3:05am    
Thank you for your comment. Yes,using doublebuffering was my first choice, but the problem is that invalidating rows in the RowPrePaint event causes the event to be fired again, and this of course causes the flickering.
George Swan 26-Jan-15 3:41am    
Sorry that I couldn't be of more help to you.
Pikoh 26-Jan-15 3:46am    
Don't worry. I've been doing some tests and it seems i'm getting closer. I'll post a solution when i find it. :)
Russel Rillema 10-Aug-22 10:12am    
Did you ever find a working solution to this?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900