Flicker in Owner Drawn ListView in VB.NET 2.0

Flicker in Owner Drawn ListView in VB.NET 2.0

Post by jason.yfh » Wed, 17 Oct 2007 19:48:33


Hi All,

I've implemented a custom draw listview overriding
System.Windows.Forms.ListView.

In VB.NET 1.0, the listview won't flicker. However, in VB.NET 2.0, the
same listview flicker a lot.

By observation on the listview on monitor, I found that in VB.NET 2.0,
every time when the listview item has to be painted, the item will be
painted as a default non-owner-drawn ListView item before the custom
DrawItem painting routine is run. So the item will flicker.

Now, the custom item will be drawn in message WndProc > OCM_NOTIFY
(&H2000+&H4E) > NM_CUSTOMDRAW (-12) > CDDS_ITEMPREPAINT (&H1 Or
&H10000).

Do you have any idea to avoid the flickering? Is it possible to stop
the default non-owner-drawn ListView item repaint by screening out
this default repaint message inside WndProc?

Thanks,
Jason