473,287 Members | 1,659 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,287 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 8797
"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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.