468,741 Members | 1,602 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,741 developers. It's quick & easy.

ListView flickering

Using VS2005, C++, .NET

I have a ListView with OwnerDraw=true, Details view, that I am using
to display messages in real-time. Ideally I want to scroll down to the
bottom, i.e. most recent message, each time one is added.

However the control flickers horribly, much worse than the RichTextBox
which I'm using elsewhere.

I've tried various techniques, double-buffering, filtering out
WM_ERASEBKGND, but none of them seem to work.

Any suggestions for a way to prevent flickering?

TIA,
KK
Mar 28 '08 #1
4 1460
Did you try using ListView.BeginUpdate and EndUpdate? Put your item
addition and scrolling calls between these two. Not sure how it
behaves with OwnerDraw, though.
--
http://www.kynosarges.de
Mar 29 '08 #2
On 29 Mar, 09:24, Chris Nahr <dioge...@kynosarges.dewrote:
Did you try using ListView.BeginUpdate and EndUpdate? *Put your item
addition and scrolling calls between these two. *Not sure how it
behaves with OwnerDraw, though.
--http://www.kynosarges.de
I haven't tried BeginUpdate and EndUpdate because all the postings
I've seen from other users say they don't work.

KK
Mar 31 '08 #3
On Mon, 31 Mar 2008 00:47:04 -0700 (PDT), ke***********@googlemail.com
wrote:
>I haven't tried BeginUpdate and EndUpdate because all the postings
I've seen from other users say they don't work.
I have no idea what postings you might be referring to. Of course
these calls work, in some way at least. They might not have the
effect you want in your specific scenario but you won't know that
until you try them.
--
http://www.kynosarges.de
Apr 1 '08 #4
ke***********@googlemail.com wrote:
However the control flickers horribly, much worse than the RichTextBox
which I'm using elsewhere.

I've tried various techniques, double-buffering, filtering out
WM_ERASEBKGND, but none of them seem to work.

Any suggestions for a way to prevent flickering?

Take a look at ControlStyles.Opaque, ControlStyles.DoubleBuffer,
ControlStyles.ResizeRedraw, etc.:

http://msdn2.microsoft.com/en-us/lib...es(VS.71).aspx
Opaque
If true, the control is drawn opaque and the background is not painted.

If I remember correctly, setting the Opaque flag is the most important
thing. Otherwise the control paints a solid background, which undermines
all your double buffering efforts (i.e. the control will fill a solid
rectangle before you paint your stuff, and that causes the most terrible
flicker).

Without seeing your code, this is the best I can recommend.

Tom
Apr 4 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Anushya | last post: by
6 posts views Thread by Joaquin Grech | last post: by
2 posts views Thread by Anushya devi | last post: by
9 posts views Thread by C# Learner | last post: by
2 posts views Thread by John Lee | last post: by
2 posts views Thread by John Lee | last post: by
5 posts views Thread by jtalbot_vizible | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
xarzu
2 posts views Thread by xarzu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.