473,396 Members | 1,891 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,396 software developers and data experts.

How to get rid of graph flicker?

Hi all,

I am programing for a user controll which is refreshing every 0.05 of a
second. the client area is flickering. I used the below code in the
constructor:
--------------------------
SetStyle(ControlStyles.OptimizedDoubleBuffer |
ControlStyles.AllPaintingInWmPaint, true);
--------------------------
It made it so much better, but it is still flickering. Is there any other
way to completely get rid of it?

Thank you in advance,
Mehrdad
Jun 27 '08 #1
5 1845
On Sat, 21 Jun 2008 07:54:08 -0700, Mehrdad <ga****@irandoc.ac.irwrote:
I am programing for a user controll which is refreshing every 0.05 of a
second. the client area is flickering. I used the below code in the
constructor:
--------------------------
SetStyle(ControlStyles.OptimizedDoubleBuffer |
ControlStyles.AllPaintingInWmPaint, true);
--------------------------
It made it so much better, but it is still flickering. Is there any other
way to completely get rid of it?
I don't understand how "it made it so much better, but it is still
flickering". "Flickering" isn't generally a matter of degrees. It's
caused by erasing on-screen and then drawing over the erased area
on-screen. You can eliminate it, but to simply "reduce" it would mean
that sometimes the control is being double-buffered and sometimes it's
not. That seems like an unlikely scenario to me.

Now, all that said...have you tried simply setting the DoubleBuffered
property to "true"? I don't ever use the control styles to control
double-buffering.

Pete
Jun 27 '08 #2
Thank you for your answer. Yes, I set the double buffering to true. I think
when the OnPaint methode is triggering, it clears the client area before
fetching the buffered information into it. Is it true? If yes, how can I
prevent it to clear?

Thanks again,
Mehrdad

"Peter Duniho" <Np*********@nnowslpianmk.comwrote in message
news:op***************@petes-computer.local...
On Sat, 21 Jun 2008 07:54:08 -0700, Mehrdad <ga****@irandoc.ac.irwrote:
>I am programing for a user controll which is refreshing every 0.05 of a
second. the client area is flickering. I used the below code in the
constructor:
--------------------------
SetStyle(ControlStyles.OptimizedDoubleBuffer |
ControlStyles.AllPaintingInWmPaint, true);
--------------------------
It made it so much better, but it is still flickering. Is there any other
way to completely get rid of it?

I don't understand how "it made it so much better, but it is still
flickering". "Flickering" isn't generally a matter of degrees. It's
caused by erasing on-screen and then drawing over the erased area
on-screen. You can eliminate it, but to simply "reduce" it would mean
that sometimes the control is being double-buffered and sometimes it's
not. That seems like an unlikely scenario to me.

Now, all that said...have you tried simply setting the DoubleBuffered
property to "true"? I don't ever use the control styles to control
double-buffering.

Pete

Jun 27 '08 #3
Thank you for your answer. Yes, I set the double buffering to true. I
think when the OnPaint methode is triggering, it clears the client area
before fetching the buffered information into it. Is it true? If yes, how
can I prevent it to clear?
I'm not sure about this, but I seem to remember something about overriding
OnPaintBackground with a method that does nothing.

Chris Jobson
Jun 27 '08 #4
On Sun, 22 Jun 2008 02:05:53 -0700, Mehrdad <ga****@irandoc.ac.irwrote:
Thank you for your answer. Yes, I set the double buffering to true.
That statement is ambiguous. "set the double buffering to true" could
mean anything. As opposed to "Set the Control.DoubleBuffered property to
true", which is very specific. So what did you actually do?
I think
when the OnPaint methode is triggering, it clears the client area before
fetching the buffered information into it. Is it true? If yes, how can I
prevent it to clear?
If you set the DoubleBuffered property to true, then even though the
background is cleared before OnPaint() is called, it's cleared in the
back-buffer, not on-screen. There should be no flickering.

On the other hand, if you use some other technique to try to enable
double-buffering (such as the code you posted), then you are responsible
for handling all of the double-buffering. This includes not erasing the
on-screen image (which is what Chris is talking about) and making sure
that you paint the entire control in the OnPaint() method, and do it all
at once (i.e. draw into your own back buffer and then copy that to the
screen Graphics instance provided in the PaintEventArgs).

Pete
Jun 27 '08 #5
Thank you very much,

Actually, as a part of a project, I am creating a histogram component which
its graphs should be as soft as possible.

Thank you for your complete answer :)
Mehrdad

"Peter Duniho" <Np*********@nnowslpianmk.comwrote in message
news:op***************@petes-computer.local...
On Sun, 22 Jun 2008 02:05:53 -0700, Mehrdad <ga****@irandoc.ac.irwrote:
>Thank you for your answer. Yes, I set the double buffering to true.

That statement is ambiguous. "set the double buffering to true" could
mean anything. As opposed to "Set the Control.DoubleBuffered property to
true", which is very specific. So what did you actually do?
>I think
when the OnPaint methode is triggering, it clears the client area before
fetching the buffered information into it. Is it true? If yes, how can I
prevent it to clear?

If you set the DoubleBuffered property to true, then even though the
background is cleared before OnPaint() is called, it's cleared in the
back-buffer, not on-screen. There should be no flickering.

On the other hand, if you use some other technique to try to enable
double-buffering (such as the code you posted), then you are responsible
for handling all of the double-buffering. This includes not erasing the
on-screen image (which is what Chris is talking about) and making sure
that you paint the entire control in the OnPaint() method, and do it all
at once (i.e. draw into your own back buffer and then copy that to the
screen Graphics instance provided in the PaintEventArgs).

Pete

Jun 27 '08 #6

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

Similar topics

9
by: Lilith | last post by:
Is there a python module somewhere (been searching today, no luck) which has efficiently coded various graph-handling routines, such as finding the shortest path through a graph, or the set of all...
4
by: Marek Mänd | last post by:
This seems an IE issue only: 4253 bytes testcase: http://www.hot.ee/idaliiga/testcases/ieselect/bnlinkingselectinmsie.htm Can one have 1) a mouseover/mouseout element on TBODY 2) change in...
0
by: mp3boss | last post by:
I am updating a string in the format MM:SS every second using the On_Timer event in Access97 by changing the caption of a label. Even though I'm using 8point text, the box sometimes flickers...
3
by: Per Dunberg | last post by:
Hi all, I have to develop a "skinned" application and I have a problem with the graphics. When a form is loaded and displayed there's aways a flicker where all the controls are located on the...
3
by: seamlyne | last post by:
The first method I ever used for multiple state buttons was to create a graphic for each button for each state: AboutUs_on, AbooutUs_over, AboutUs_out, etc. That works great when there are just a...
17
by: pigeonrandle | last post by:
Hi, I have seen loads of different ways to do this, but the all seem to yield the same result - text that doesn't flicker when it's moving too slowly! Does anyone know 'the best way' to make text...
1
by: Wayne | last post by:
I've noticed some screen flicker when using Access 2003 under Vista and I'm curious as to whether this is a bug or peculiar to my machine. In design view, if I make changes to a form and then...
4
by: Frank Rizzo | last post by:
Hello, I inherited a large Winforms project that is suffering from excessive flicker when switching between portions of the application. I've noticed that most parts of the application (user...
4
by: Man4ish | last post by:
namespace ve/////////////////ve.h { struct VertexProperties { std::size_t index; boost::default_color_type color; }; }...
0
by: Rainer Queck | last post by:
Hello NG, I had/have a bad flicker Problem with my Application. On starting some applications, while my app was running, the whole Display started to flicker. Even the desktop Icons! Looking...
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:
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.