Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Windows Forms
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 29-Sep-12 1:20am
Comments
supernorb at 29-Sep-12 14:27pm
   
A bit strange, I've never seen this before! Someone may want to downvote you :(
Amol Borkar, Pune, India at 1-Oct-12 9:31am
   
Make sure that you are not changing page TOP/RIGHT/LEFT on page load
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

try using SuspendBinding() and ResumeBinding(), it may solve your problem.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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
protected override CreateParams CreateParams 
{
    get {
        CreateParams cp = base.CreateParams;
        cp.ExStyle = cp.ExStyle | 0x2000000;
        return cp;
    }
}
Happy Coding!
Smile | :)
  Permalink  
v2
Comments
siddarth nair at 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 at 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 at 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)

  Print Answers RSS
0 OriginalGriff 6,803
1 Sergey Alexandrovich Kryukov 6,377
2 DamithSL 5,421
3 Manas Bhardwaj 4,841
4 Maciej Los 4,330


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 1 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100