Click here to Skip to main content
15,905,322 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Now.I've set my form in visual studio 2008 to full screen by fix WindowState to maximized and change FormBorderStyle to None and i've my image to set background image
and backgroundcolor i'm set to white color

the problem was happen when i've change BackgroundimageLayout to stretch that i've change because when i've complie my program is to slow but when i've change BackgroundimageLayout to stretch my program is faster but the problem was here my programdisplay was flashing between my backgroundimage and backgroundcolor

Can anyone help me to fix this problem

Ps. Sorry for my english i'm not good for english

thank you very much
Posted
Updated 15-Feb-12 6:13am
v3
Comments
shelby67 15-Feb-12 11:55am    
My guess is that the reason this is happenin is because if it has to stretch the image its constantly remapping it then resizing it. If its a static size then theres none of that.
pongpanut 15-Feb-12 12:03pm    
Now i've try to change BackgroundimageLayout to center but i've got same problem i don't know why i got this problem

1 solution

To flight flashing, you need to use double buffering. For a form, please use System.Windows.Forms.From.DoubleBuffered property, http://msdn.microsoft.com/en-us/library/system.windows.forms.control.doublebuffered.aspx[^].

It can practically eliminate flashing.

If you have flashing with some other control, you need to sub-class such control in order to get access to a protected method System.Windows.Forms.Control.SetStyle. You would need to add the styles ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint.

Please see:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.setstyle.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.controlstyles.aspx[^].

You can use this method with the Form as well as it is Control.

If you code is slow, you must be doing something wrong (double buffering can only made it a little bit slower), but it's hard to say anything without some code sample to manifest this problem.

—SA
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 16-Feb-12 3:17am    
OP commented:

Thank you for SAKryukov answer

I've get SAKryukov idea to fix this problem

I've set Property DoubleBuffered = True

and It's work my form haven't flashing anymore

Thank you very much
Sergey Alexandrovich Kryukov 16-Feb-12 3:18am    
You are very welcome (only please keep suck posts to comments, don't post as a solution).

Thank you for reporting it back.

Good luck, call again.
--SA
pongpanut 16-Feb-12 4:32am    
thankyou for guild me

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