Sunday, March 14, 2004 11:56 PM szurgot

Frustration with Flicker

I'm working with the ListView Control (in Details mode) and I'm frustrated. Functionally, it's a great tool. Fast and missing only one feature for what I'm doing (It doesn't raise an event when the FocusedItem changes which was easy enough to implement) But, it flickers something fierce. If you don't have an icon attached to the row, and you add or change a row, the first item flickers. When you have an icon attached to the row, the entire thing flickers, even if the row being added or updated is off-screen. It's truely enough to give one a headache. A full screen program clearing and redrawing the screen, a few times a second, just to update an icon.

I've tried everything I can to get it to not flicker. Begin/EndUpdate() doesn't work (lergely because it's only supposed to delay redraw while multiple updates are made, not changing the way updates are handled) I've tried DoubleBuffering, but the painting doesn't seem to be handled by the controls PaintMehod, I've even tried other List controls, but they are too slow when dealing with a full screen app.

And I've worked with the status bar, and an Owner Draw Panel to display a progress bar, and *it* flickers.

And Whidbey Technology Preview doesn't fix this.

So my biggest wish for Whidbey (besides all the ones already being implemented) is to fix the flicker issues of the controls. Please! Just to keep my cost of Aspririn down.

(Update: Just to be clear, AddRange doesn't work any better than Begin/EndUpdate() because the adds and updates are supposed to be separate. I've also tried LockWindowUpdate and WM_SETREDRAW. Nothing works because (I think) it's not the timing of the refresh, it's the refresh itself.)

Filed under:

Comments

# RE: Frustration with Flicker

Monday, March 15, 2004 7:44 AM by Scott_NO_@_SPAM_Tripleasp.net (Scott Watermasysk)

Have you tried adding an array of items (addRange) instead of adding each one individaully?

ListViewItem[] items = new ListViewItem[entries.Length];
for(int i = 0; i<items.Length; i++)
{
items[i] = GetListViewItem(entries[i]);
}
this.listEntries.Items.AddRange(items);

I have not done much with the ListView control, but I have had much better results adding by range instead of individually.

# re: Frustration with Flicker

Monday, March 15, 2004 12:59 PM by Craig Gemmill

Have you tried the good ol' LockWindowUpdate API? I find that it still works best in some situations.

# re: Frustration with Flicker

Monday, March 15, 2004 1:19 PM by Chris Szurgot

Not only does LockWindowUpdate not work, but it causes a problem where every Icon on my desktop flickers as well.

# re: Frustration with Flicker

Tuesday, March 16, 2004 11:31 PM by Omar Shahine

http://www.codeproject.com/useritems/ListViewXP.asp

I use this extensively and have no flicker.

# The perils of premature optimization

Sunday, June 13, 2004 9:48 PM by TrackBack