472,347 Members | 2,230 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

how to avoid flickering in listview?

Hi

I did alot of research on this on the web and msdn and I couldn't find
anything.

I have a listview showing as a grid (table looking, with rows and columns
and no images at all, only text). I get the information to display on the
listview from the network and I add items often and stuff.

But more than adding items, what worries me is the step of modifying items.
I change the text of one of the columns for every row every 2 seconds.
Something like: "Time to next update: X seconds"
and that text changes every 2 seconds.

Every time i change the text, the item flickers. When I have 50 rows the
screen looks like a discoteque so it is not good.

I found lot of examples on avoiding flickering but most of them don't work,
are not correctly implemented or are thought for other
circunstances/controls.

I found that I could extend the listview control and add this to my
constructor:
this.SetStyle(ControlStyles.DoubleBuffer |

ControlStyles.UserPaint |

ControlStyles.AllPaintingInWmPaint,

true);

this.UpdateStyles();

that should enable double buffering, but i don't know how to draw the items
manually from there.

Any help would be greatly appreciated.

Joaquin Grech


Nov 15 '05 #1
6 8636
"Joaquin Grech" <cr*******@bigfoot.com> wrote in message
news:uV**************@TK2MSFTNGP09.phx.gbl...
Every time i change the text, the item flickers. When I have 50 rows the
screen looks like a discoteque so it is not good.


See BeginUpdate() and EndUpdate().

-- Alan
Nov 15 '05 #2
I just posted an answer to that... it doesn't work

"Alan Pretre" <no@spam> wrote in message
news:Oe*************@TK2MSFTNGP10.phx.gbl...
"Joaquin Grech" <cr*******@bigfoot.com> wrote in message
news:uV**************@TK2MSFTNGP09.phx.gbl...
Every time i change the text, the item flickers. When I have 50 rows the
screen looks like a discoteque so it is not good.


See BeginUpdate() and EndUpdate().

-- Alan

Nov 15 '05 #3
Just to make myself clear, I call this every 2 seconds:

listView1.BeginUpdate();

foreach (ListViewItem aux in listView1.Items)

{

aux.SubItems[3].Text="some changing text here";

}

listView1.EndUpdate();

I thought this would stop the flickering by using beginupdate/endupdate but
the flickering is still there... any ideas?

Joaquin Grech

"Joaquin Grech" <cr*******@bigfoot.com> wrote in message
news:uV**************@TK2MSFTNGP09.phx.gbl...
Hi

I did alot of research on this on the web and msdn and I couldn't find
anything.

I have a listview showing as a grid (table looking, with rows and columns
and no images at all, only text). I get the information to display on the
listview from the network and I add items often and stuff.

But more than adding items, what worries me is the step of modifying items. I change the text of one of the columns for every row every 2 seconds.
Something like: "Time to next update: X seconds"
and that text changes every 2 seconds.

Every time i change the text, the item flickers. When I have 50 rows the
screen looks like a discoteque so it is not good.

I found lot of examples on avoiding flickering but most of them don't work, are not correctly implemented or are thought for other
circunstances/controls.

I found that I could extend the listview control and add this to my
constructor:
this.SetStyle(ControlStyles.DoubleBuffer |

ControlStyles.UserPaint |

ControlStyles.AllPaintingInWmPaint,

true);

this.UpdateStyles();

that should enable double buffering, but i don't know how to draw the items manually from there.

Any help would be greatly appreciated.

Joaquin Grech

Nov 15 '05 #4
Maybe

listView1.SuspendLayout();
....
....
listView1.ResumeLayout();

?

Cybertof.
In article <eU**************@TK2MSFTNGP10.phx.gbl>, creative1
@bigfoot.com says...
Just to make myself clear, I call this every 2 seconds:

listView1.BeginUpdate();

foreach (ListViewItem aux in listView1.Items)

{

aux.SubItems[3].Text="some changing text here";

}

listView1.EndUpdate();

I thought this would stop the flickering by using beginupdate/endupdate but
the flickering is still there... any ideas?

Nov 15 '05 #5
nice try, but nope

"Cybertof" <cy****************@gmx.net> wrote in message
news:MP************************@msnews.microsoft.c om...
Maybe

listView1.SuspendLayout();
...
...
listView1.ResumeLayout();

?

Cybertof.
In article <eU**************@TK2MSFTNGP10.phx.gbl>, creative1
@bigfoot.com says...
Just to make myself clear, I call this every 2 seconds:

listView1.BeginUpdate();

foreach (ListViewItem aux in listView1.Items)

{

aux.SubItems[3].Text="some changing text here";

}

listView1.EndUpdate();

I thought this would stop the flickering by using beginupdate/endupdate but the flickering is still there... any ideas?

Nov 15 '05 #6
should i give up on this?

I got tons of samples on the web using lockwindowupdate, setstyle and other
wonderful stuff like handleing WM_PAINT and erasebg... nothing worked.

Anyone has a code that would make something as simple as this on a listview
work without flickering?

foreach (ListViewItem aux in listView1.Items)

{

aux.SubItems[3].Text="some changing text here";

}

looks simple? well... i found 250 posts from people with similar problems
and no one single one answered right :(

I guess the right solution would be using
this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint, true);

and drawing all the list items manually, but I have no idea how to do this.

Any code would be greatly appreciated.

Joaquin Grech
"Joaquin Grech" <cr*******@bigfoot.com> wrote in message
news:uV**************@TK2MSFTNGP09.phx.gbl...
Hi

I did alot of research on this on the web and msdn and I couldn't find
anything.

I have a listview showing as a grid (table looking, with rows and columns
and no images at all, only text). I get the information to display on the
listview from the network and I add items often and stuff.

But more than adding items, what worries me is the step of modifying items. I change the text of one of the columns for every row every 2 seconds.
Something like: "Time to next update: X seconds"
and that text changes every 2 seconds.

Every time i change the text, the item flickers. When I have 50 rows the
screen looks like a discoteque so it is not good.

I found lot of examples on avoiding flickering but most of them don't work, are not correctly implemented or are thought for other
circunstances/controls.

I found that I could extend the listview control and add this to my
constructor:
this.SetStyle(ControlStyles.DoubleBuffer |

ControlStyles.UserPaint |

ControlStyles.AllPaintingInWmPaint,

true);

this.UpdateStyles();

that should enable double buffering, but i don't know how to draw the items manually from there.

Any help would be greatly appreciated.

Joaquin Grech

Nov 15 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Phill | last post by:
I've got a Listview control (Detail mode) that I'm adding rows to on another thread from a DB query. The result is about 32,000 rows ans takes a...
2
by: John Lee | last post by:
Hi, I have a windows application that uses the listview to display about 50 items in detailed view - 4 columns. The first column is static and...
2
by: John Lee | last post by:
Thanks Jay for your response. I tried your code and it still flickering a lot. To demonstrate it, you can grab a listview, create 3 columns -...
5
by: jtalbot_vizible | last post by:
I was looking at the code on codeproject to solve my listview flickering issue. All the references to functions in the rest of my post refer to...
0
by: James | last post by:
Hi all, I have made a derived Listview which can accept the controls as items in it. Controls that we are using are Buttons in each row and...
0
by: James | last post by:
Hi all, I have made a derived Listview in C# .net 1.1 framework, which can accept the controls as items in it. Controls that we are using are ...
4
by: R.A.F. | last post by:
Hi, Basically i've read that under C++ we can avoid flickering forms during sizing (maximize, minimize, restore,...) in SDi/MDI application. I...
4
by: kelvin.koogan | last post by:
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...
0
by: IanWright | last post by:
I'm trying to change the cursor that appears on a standard ListView when the cursor appears over an item. However I am getting a flickering effect as...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...

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.