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

ListView flickering

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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.