Click here to Skip to main content
15,896,118 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello all . (Language : C# .NET)
I have a form with a couple of big buttons on it . each button has on it a user control i created with some sort of dynamic graph paintings .
the control is placed on top of the button, and has a pic box that i do my paintings on . the actual drawing is done with a timer, and for each timer.Tick the drawing is changing .

my BIG problem is, every time i enter and leave the button area, it causes an event that repaints its whole area, including my control on it. I dont want it to happen, i just want the button to normally change it backcolor and style, when entering/leaving/clicking, but my control with the pic box with paintings not to be affected, not to repaint .

is there anyway sombody can help me here???

thanks ~!!
Posted
Updated 23-Aug-10 7:09am
v2

You can turn on double buffering, and perhaps look to see if you're calling Invalidate() anywhere, which would be causing a paint event across the whole form.

this.SetStyle(
ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint |
ControlStyles.DoubleBuffer,true);
 
Share this answer
 
actually this has nothing to do with double buffering mate . the whole repaint within the pic box area is because i enter/leave/click the button that surrounds this control .

how do I avoid it ??
 
Share this answer
 
Comments
Christian Graus 24-Aug-10 1:43am    
You should not push 'answer' to post a comment. Instead you should push 'comment', like I did. It's hard to understand exactly what is going on from your convoluted explanation, it sounds like your controls are on top of each other, which is why they are forcing an invalidate, and double buffering is all you can do about that, unless you ditch the picture box and draw your own graphs on your form.

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