By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,166 Members | 1,575 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,166 IT Pros & Developers. It's quick & easy.

How to Prevent Flicker when Updating ListView

P: n/a
Some of the eagle-eyed amongst you will spot this as a direct follow on from
my earlier post about critical timing in .NET.

I want to use a ListView to display my output (instead of the sluggish
RichTextBox), but it flickers madly when I update it. There have been
numerous posts about this, but I have found no solution. Enabling
double-buffering does not seem to help, so has anyone any idea how it can be
done?

TIA

Charles
Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Charles,

Did you already look about the messages from our newsgroup flicker (not in
the Dutch meaning) expert Mick

http://groups-beta.google.com/group/...0dce829000245a

Cor
Nov 21 '05 #2

P: n/a
Charles,

Forget it, I saw listview in the thread however it was not as your problem.

I find it needles to tell to you that there is a standard option for that,
because I assume that you know that and does not work for you as you expect.

Cor
Nov 21 '05 #3

P: n/a
Use the .BeginUpdate, .EndUpdate methods of the ListView class.

"Charles Law" <bl***@nowhere.com> wrote in message
news:OR**************@TK2MSFTNGP15.phx.gbl...
Some of the eagle-eyed amongst you will spot this as a direct follow on
from my earlier post about critical timing in .NET.

I want to use a ListView to display my output (instead of the sluggish
RichTextBox), but it flickers madly when I update it. There have been
numerous posts about this, but I have found no solution. Enabling
double-buffering does not seem to help, so has anyone any idea how it can
be done?

TIA

Charles

Nov 21 '05 #4

P: n/a
Hi David

Thanks for the response. Sadly that does not help, though. I already have it
in place. Every time the EndUpdate method is called the control refreshes,
hence the flicker. I am adding a row every 200 ms, say, and the flicker is
especially bad.

Charles
"David Pendleton" <qn****@gpd.arg> wrote in message
news:eX**************@tk2msftngp13.phx.gbl...
Use the .BeginUpdate, .EndUpdate methods of the ListView class.

"Charles Law" <bl***@nowhere.com> wrote in message
news:OR**************@TK2MSFTNGP15.phx.gbl...
Some of the eagle-eyed amongst you will spot this as a direct follow on
from my earlier post about critical timing in .NET.

I want to use a ListView to display my output (instead of the sluggish
RichTextBox), but it flickers madly when I update it. There have been
numerous posts about this, but I have found no solution. Enabling
double-buffering does not seem to help, so has anyone any idea how it can
be done?

TIA

Charles


Nov 21 '05 #5

P: n/a
Ok chaps. I have the answer.

It would seem that I had mis-read the purpose of the BeginUpdate/EndUpdate
methods; like many before me I suspect.

These commands actually make the update occur, thus causing the flicker not
reducing it.

I tried all sorts of things, from double-buffering to sub-classing and
filtering the WM_ERASEBKGND message. I even tried LockWindowUpdate from one
of our esteemed number from way back. None of these worked.

The answer is as simple as calling the Update method after adding each item.

<code>
With ListView1
Dim lvi As New ListViewItem("Some really important information")

lvi.ForeColor = Color.Green

.Items.Add(lvi)

.EnsureVisible(.Items.Count - 1)

.Update()
End With
</code>

The result is a silky smooth update, with no flicker. No sub-classing,
filtering, or double-buffering required.

Can you tell I'm happy :-))

Charles
"Charles Law" <bl***@nowhere.com> wrote in message
news:OR**************@TK2MSFTNGP15.phx.gbl...
Some of the eagle-eyed amongst you will spot this as a direct follow on
from my earlier post about critical timing in .NET.

I want to use a ListView to display my output (instead of the sluggish
RichTextBox), but it flickers madly when I update it. There have been
numerous posts about this, but I have found no solution. Enabling
double-buffering does not seem to help, so has anyone any idea how it can
be done?

TIA

Charles

Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.