-
November 18th, 2008, 04:00 AM
#1
ListView & flickering & DoubleBuffered
Hello,
i solved my flickering problems with ListView setting DoubleBuffered property to true.
Now I am wondering:
why is DoubleBuffered set to false by default?
when DoubleBuffered should be kept set to false? Is there any unwanted side-effect when DoubleBuffered is set to true?
I'm asking this because my overridden ListView is always used by my apps with DoubleBuffered=true.
Mr. Burns
-
November 18th, 2008, 04:15 AM
#2
Re: ListView & flickering & DoubleBuffered
Because it is unnecessary in most situations and requires more resources to perform. Is your ListView flickering when you add a lot of items at once? If so, use the AddRange() method instead. If it is flickering when the mouse hovers over...well, yeah, you may have to use double buffering.
-
November 18th, 2008, 04:52 AM
#3
Re: ListView & flickering & DoubleBuffered
I'm not noticing any side-effect (with DoubleBuffered=true), even on ListViews that have a small amount of items and would not require it.
I was already using AddRange, but it was not sufficient, because there happen very frequent calls to AddRange that cannot be done altogether (data comes from an external device and is put into the ListView, the frequence depends on the device).
Mr. Burns
-
November 18th, 2008, 02:12 PM
#4
Re: ListView & flickering & DoubleBuffered
You won't see any side effects, but it is not usually necessary. When exactly is this flickering occurring?
-
November 18th, 2008, 02:42 PM
#5
Re: ListView & flickering & DoubleBuffered
I have no more problem with the flickering (I used DoubleBuffered property).
It's just that I wonder why not setting it to true by default in the Framework, when there's no side-effects.
Mr. Burns
-
November 18th, 2008, 03:04 PM
#6
Re: ListView & flickering & DoubleBuffered
Originally Posted by MontgomeryBurns
It's just that I wonder why not setting it to true by default in the Framework, when there's no side-effects.
There ARE side effects, including increased resource utilization. Just because you are not observing them does not mean they dont exist.
ps: Has anyone seen my cat?
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
November 18th, 2008, 03:48 PM
#7
Re: ListView & flickering & DoubleBuffered
Exactly. Again, you may not notice it, but drawing to a surface first and then blt'ing that image to the active graphics object is more resource intensive. Why use resources that are not needed? I am asking you about the conditions which are causing the flickering. You may be doing something inefficiently. If that is the case, double-buffering is simply a band-aid.
@CPU: I like the Schrödinger analogy
Last edited by BigEd781; November 18th, 2008 at 03:51 PM.
-
November 19th, 2008, 04:35 AM
#8
Re: ListView & flickering & DoubleBuffered
OK, I understand. But do you really think that such a memory allocation could be a problem when working on PC Windows system, with virtual memory and so on? My app is not run under embedded systems with reduced memory availability.
app conditions:
I was already using AddRange, but it was not sufficient, because there happen very frequent calls to AddRange that cannot be done altogether (data comes from an external device and is put into the ListView, the frequence depends on the device).
Mr. Burns
-
November 19th, 2008, 04:43 AM
#9
Re: ListView & flickering & DoubleBuffered
maybe you could try listview.BeginUpdate(), then add all the items en at the end listview.EndUpdate()
-
November 19th, 2008, 05:23 AM
#10
Re: ListView & flickering & DoubleBuffered
Originally Posted by dannystommen
maybe you could try listview.BeginUpdate(), then add all the items en at the end listview.EndUpdate()
thanks but I already tried that, only DoubleBuffered seems to solve this problem. I don't see why you all seem to dislike this solution .
Mr. Burns
-
November 19th, 2008, 03:13 PM
#11
Re: ListView & flickering & DoubleBuffered
It's not that we don't like it, but personally I think it may be avoidable and is probably caused by something that you are doing, not a problem with the control. Maybe your conditions do require it, and that is fine. But you don't want to write inefficient code just because taking up a little more memory here and there is easier (you also don't want to get crazy with optimizations. There is a balance). I sounds as if you are adding rows to this listbox quite often, so perhaps double-buffering the control is a fine solution.
-
April 16th, 2009, 01:01 AM
#12
Re: ListView & flickering & DoubleBuffered
I also wonder about why the hell double buffering isn't enabled by default. The most annoying reason I find is that when you start resizing the width of columns in a list view, it literally has an epileptic fit with how much the screen flickers.
If you've ever programmed in MFC, you will find that this annoying flicker DOES NOT occur in the MFC listviews.
Furthermore, why the hell is it a protected property? Everytime I have to double buffer it I must derive my own listview class from the .NET inbuilt one. Why can't it just be simply a public property like most of the other properties?
So it looks like M$ have gone backwards with the listview implementation in .NET. I seriously think it's flawed. What is the justification?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|