473,320 Members | 1,926 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,320 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 8804
"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 while to finish. I'm adding the rows like this...
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 other columns will be updated in 100-1000ms - it...
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 - name, value, timestamp, in form_load event to add 50...
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 that code. It's available at...
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 implemented Grouping with the help of controls(label on...
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 Buttons in each row and implemented Grouping with...
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 understood that for that i need to override the...
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 scroll down to the bottom, i.e. most recent...
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 the mouse is changed to a finger cursor, and then...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.