Question

I have an ownerdrawn ListView that "smears" when I scroll. It only affects the last displayed item as it moves into the visible are of the list...

It looks like:

Blah
Blah
Blah

...have all been drawn on top of each other 1 pixel apart. The code in the DrawItem event is of the form

Rectangle rect = new Rectangle(e.Bounds.X + mIconSize.Width, 
   e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);
e.Graphics.DrawString(episode.ToString(), this.Font, mBlackBrush, rect);

I'm completely stumped. Any ideas gratefully appreciated! Dave

Was it helpful?

Solution

You can enable double buffering for ListView by deriving from it and setting DoubleBuffered = true. There's a noticeable reduction in flicker, especially in Tile view, once you turn Double Buffering on.

OTHER TIPS

In detail view drawing do all of your drawing in DrawSubItem(...). The problem is drawItem is getting called for the first item and DrawSubitem is also for the same item ... with slightly different bounds.

also, int the form's own properties, you can enable DoubleBuffer. additionally, there are a couple of commands you can use.

More information can be found by searching DoubleBuffer C# at google (sorry, as a new user I can't post links).

This is a known bug in the ListView control.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top