i have a user control, and it's not drawn correctly, how to debug the drawing? If i set break point, the control will get blocked, i can't see the drawing result instantly? any idea?
+3
A:
It's best to debug drawing activities with a multi-monitor setup, but there are a handful of other things that can help if you've only got one monitor.
- Repositioning your IDE (Visual Studio) so that it doesn't overlap. Unfortunately, this may not help if you need active focus on the control.
- Draw a 2nd copy into a bitmap, and write the bitmap to disk or redisplay it in a dialog or some other window. This is a bit of extra work, but conceptually the same as doing logging.
- Alter your drawing code so that certain elements or certain parts of elements are only drawn if you have certain keys pressed down (left-shift/right-shift, ctrl, alt, or some combination of those keys). This is easy to add and can allow you to filter out parts of your code that would be tricky to step into with the debugger.
Here's the function that can provide the state for you (requires p/invoke) and the signature from pinvoke.net.
GetKeyState Function() @ MSDN
pinvoke.net: GetKeyState (user32)
meklarian
2009-12-10 05:29:52
cool. thanks for the visualizer
Benny
2009-12-11 17:14:33