473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Enabling double buffering for a ListView control?


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
4 8577
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Alex Glass | last post by:
I have read plenty about applying double buffering for animation and self drawn forms. Is there a way to apply it to a form with many standard controls on it (textboxes, labels etc) ?? I have...
2
by: Jason | last post by:
I have created a 2d isometric game map using tiles and now I'm trying to move around my map..when i go near the edge of the map I want to redraw the map to show new parts of the map however the...
1
by: Kuba Florczyk | last post by:
Hi I've got some problem doing double buffer. Here is my problem: I've got custom control on which i paint some data (chat messages, lets call it ChatControl), this control is puted on a...
1
by: Brian Henry | last post by:
In the documentation for the listview for owner drawn it says this Note To avoid issues with graphics flickering when owner drawing, override the ListView control and set the DoubleBuffered...
0
by: Brian Henry | last post by:
I am trying to do a owner drawn list view in detail mode, when i inherited the list view into a new custom control then turned on double buffering all the sudden the selection rectangle is the...
7
by: Rain | last post by:
Hello Gurus! I really need this one to finish a module in my thesis. PLease please help me. I need a double buffer class so i can call it and use it anytime i want, the problem is everything ive...
1
by: TyBreaker | last post by:
I notice in VB 2005 that I can set a form to be double-buffered just by setting that option to true in the Form properties. I have a panel on that form but there doesn't appear to be a...
3
by: ssoffline | last post by:
hi i have an app in which i can drop objects onto a form and move them, it consists of graphics (lines), i am using double buffering to avoid filckering in the parent control which is a panel,but...
1
by: Rune Jacobsen | last post by:
Hi, I have a question about double buffering, or more specifically, when to apply it. As mentioned in another post, I have a control that basically contains three other controls. This parent...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.