|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to Prevent Flicker when Updating ListViewSome 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 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/microsoft.public.dotnet.languages.vb/browse_frm/thread/e402f82c888c902a/120dce829000245a?q=mick+flicker+listview&rnum=1#120dce829000245a Cor 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 Use the .BeginUpdate, .EndUpdate methods of the ListView class.
Show quoteHide quote "Charles Law" <bl***@nowhere.com> wrote in message news:ORHzf6WMFHA.3320@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 > > 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 Show quoteHide quote "David Pendleton" <qni***@gpd.arg> wrote in message news:eXc3PmaMFHA.3988@tk2msftngp13.phx.gbl... > Use the .BeginUpdate, .EndUpdate methods of the ListView class. > > > > "Charles Law" <bl***@nowhere.com> wrote in message > news:ORHzf6WMFHA.3320@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 >> >> > > 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 Show quoteHide quote "Charles Law" <bl***@nowhere.com> wrote in message news:ORHzf6WMFHA.3320@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 > > |
|||||||||||||||||||||||