Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0 buttons GUI
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 23-Aug-10 7:55am
noamy26466
Edited 23-Aug-10 8:09am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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);
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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 ??
  Permalink  
Comments
Christian Graus at 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)



Advertise | Privacy | Mobile
Web02 | 2.8.1411022.1 | Last Updated 24 Aug 2010
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