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

Enabling double buffering for a ListView control?

P: n/a

I wanted to enable double buffering for my list view control to avoid
flicker when adding or removing new records, so I subclassed it. However, I
just plain don't get ANYTHING displayed after enabling double buffering. Is
there more to this functionality than meets the eye?

Public Class ListViewDblBuffer
Inherits ListView

Public Sub EnableDblBuffer()
Me.SetStyle(ControlStyles.DoubleBuffer _
Or ControlStyles.UserPaint _
Or ControlStyles.AllPaintingInWmPaint, _
True)
Me.UpdateStyles()
End Sub
End Class
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Cor
Hi Robin,
I wanted to enable double buffering for my list view control to avoid
flicker when adding or removing new records.


Do you know there are two methods to prevent that?

"Listview1.BeginUpdate()" and "listview1.EndUpdate()"

Maybe that is easier for the problem?

Cor
Nov 20 '05 #2

P: n/a
Yes, but I still get flicker with BeginUpdate and EndUpdate in use. I'm
thinking that because it isn't double buffered, its going to "blank" the
window before rendering regardless. I double buffered my ListBox items
(custom drawn) manually before I saw that double bufferring was an option in
there and windows forms can do it for you - but I can't seem to get it to
work!
"Cor" <no*@non.com> wrote in message
news:3f***********************@reader21.wxs.nl...
Hi Robin,
I wanted to enable double buffering for my list view control to avoid
flicker when adding or removing new records.


Do you know there are two methods to prevent that?

"Listview1.BeginUpdate()" and "listview1.EndUpdate()"

Maybe that is easier for the problem?

Cor

Nov 20 '05 #3

P: n/a
Hi Robin,

As you hadn't mentioned it, I was going to suggest Begin and End Update,
but Cor beat me to it! :-)

I notice that you are using the UserPaint style. The documentation for it
says
The control paints itself rather than the operating system doing so.

I don't think it was worded very well - 'paints itself' means that <you>
get to paint it! Do you have your own painting code for the ListView as well?

On the other hand, if you are custom drawing your ListItems, shouldn't
<they> be the ones which you subclass so that you can give them
ControlStyles.DoubleBuffer?

This isn't from experience. I'm only throwing ideas out here, and may be
well off the mark.

Regards,
Fergus
Nov 20 '05 #4

P: n/a
You are right, what an idjeet I am. I don't want to owner draw it, just
have it double buffered.

Nice one - its fine now.

"Fergus Cooney" <fi******@tesco.net> wrote in message
news:OH****************@tk2msftngp13.phx.gbl...
Hi Robin,

As you hadn't mentioned it, I was going to suggest Begin and End Update, but Cor beat me to it! :-)

I notice that you are using the UserPaint style. The documentation for it says
The control paints itself rather than the operating system doing so.
I don't think it was worded very well - 'paints itself' means that <you> get to paint it! Do you have your own painting code for the ListView as well?
On the other hand, if you are custom drawing your ListItems, shouldn't
<they> be the ones which you subclass so that you can give them
ControlStyles.DoubleBuffer?

This isn't from experience. I'm only throwing ideas out here, and may be well off the mark.

Regards,
Fergus

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.