Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have a form which has a background image. It seems to flicker when components begin to load on to the form. I have tried using Double buffering, Control.SetStyle(...), still gives me the problem. Any ideas to deal with this?

thanks in advance.
Posted
Comments
supernorb 29-Sep-12 14:27pm    
A bit strange, I've never seen this before! Someone may want to downvote you :(
Amol_27101982, India 1-Oct-12 9:31am    
Make sure that you are not changing page TOP/RIGHT/LEFT on page load

try using SuspendBinding() and ResumeBinding(), it may solve your problem.
 
Share this answer
 
it is strange check you have done some paint event that is conflicting or some dynamic control which you are adjusting runtime...

if you want to not show flicker
means below code will show your form after it complete painting

put this property in your form and check effect
C#
protected override CreateParams CreateParams 
{
    get {
        CreateParams cp = base.CreateParams;
        cp.ExStyle = cp.ExStyle | 0x2000000;
        return cp;
    }
}

Happy Coding!
:)
 
Share this answer
 
v2
Comments
siddarth nair 1-Oct-12 14:51pm    
Hey thanks Aarti...This seems to be a very good piece of code... and ofcourse something new for me..
It din't help me to sort this proble but yes it helped me in a different program.

The problem is I am trying to create an explorer kind of app which gives me the list of all files in a folder. Now each file is represented by a Button. So basically am doing a recursive search in each directory. If a particular Directory has ample amount of files, by the time all the buttons are loaded the form keeps flickering when a new button is created runtime. This is something i want to avoid. The situation is worse when i have a background image on the form. :(
Aarti Meswania 2-Oct-12 1:16am    
you are performing a lengthy process, you can use concept of thread for that purpose.

another thing is this property will make your form's look like,...
it is going 'hang' (flickering is hidden). some process is going on when it is complete with full design it will show that form with all controls, this is actual use of this property
:)
Raghavendra setty 5-Oct-12 9:49am    
hide the control which u r populating and show show some kind of loading image (overlapping the control which is flickering), use a background thread to populate the control and once data is loaded, hide the loading image and show u r controls, this will solve the flickering issue.
Happy coding !

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900