Click here to Skip to main content
14,216,534 members
Rate this:
Please Sign up or sign in to vote.
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. :)

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100