Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Controls / March 2008

Tip: Looking for answers? Try searching our database.

Ugly flicker when updating a ListView in VirtualMode

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ulrich Proeller - 27 Mar 2008 17:31 GMT
Hello,

I am using a ListView derived class in VirtualMode to display millions of
lines (Details view). DoubleBuffering is on.
The underlying data is frequently updated. The ListView is informed of the
update by setting the VirtualListSize property.

There are three scenarios:
1. The ListView always scrolls to the last message. => Everything ok, no
flicker.
2. A row is selected and visible, no scrolling occurs but the underlying
data is still being updated. => Everything OK, no flicker, only the scroll
bar is sligtly moving as expected.
3. A row is selected but the selected row was scrolled outside the visible
area of the ListView and is no longer visible. => Ugly flickering occurs.

I examinded the third scenario and found, that each time I set the
VirtualListSize, the ListView is processing TWO WM_PAINT messages .
In the first, it paints the selected row and the rows adjacent to the
selection (which shouldn't be painted).
The second WMPaint then paints the rows, which are expected to be painted.

I don't know, why there are 2 WM_PAINT messages and how to prevent the first
one, which isn't necessarry and is responsible for the flicker.

I appreciate any idea hot to solve this problem.

Regards

Ulrich Proeller
Bob Powell [MVP] - 27 Mar 2008 19:07 GMT
ListView wraps the old Win32 ListView control so has very little forms aware
functionality. I don't think double bufering works at-all for it.

Two WM_PAINTS are pretty much standard. The system has been doing it for
years. I'd worry if it only sent one.

The only way I have found for using ListView anywhere near it's true
capabilities - and it is despite all outward appearences really powerful -
is to override the WndProc and start using all the specialised ListView
messages.

To be honest I would advise you to either get a phenomenally good
understanding of ListView or use a different control.

Signature

Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

> Hello,
>
[quoted text clipped - 27 lines]
>
> Ulrich Proeller
Ulrich Proeller - 28 Mar 2008 09:08 GMT
Thanks for your quick answer!

> To be honest I would advise you to either get a phenomenally good
> understanding of ListView or use a different control.

What I need is a fast list control which can show up to a million lines,
resize, reorder and hide columns and show an icon at the beginning of each
line. I don't need editing capabilities, subitems, groups.

Would you propose the Windows GridControl or a commercial ListControl (e.g.
Infragistics)?

Ulrich
Bob Powell [MVP] - 30 Mar 2008 23:24 GMT
The phrases "Fast control" and "million lines" are not ones that should be
in the same sentence.

Anyone who loads a control with a million lines of data or even uses a
virtual mode to select from that million lines is likely to be disappointed.

I work in a commercial bank where the number of transactions are huge and we
are constantly making trade-offs between performance and quantitiy of lines.
I have never seen a one-size-fits-all solution and we have used
Infragistics, standard Windows Forms, SyncFusion, Dundas, indeed all the
major players were evaluated extensively by our teams. I assure you I've
seen them all and I still can't instantly choose one just from simple
criteria.

Depending on the application we use the control best suited. We have no
financial constraints so all the tools we buy are purely there because they
fulfil a need. We have lots of them and they all apply well to different
tasks.

If you just want raw display of data, stick with a standard Microsoft
control. These are well thought out and fit well into the framework. If you
need pretty but can sacrifice some performance, go for Infragistics.

Signature

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

> Thanks for your quick answer!
>
[quoted text clipped - 10 lines]
>
> Ulrich

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.