tags:

views:

83

answers:

2

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.

  1. Repositioning your IDE (Visual Studio) so that it doesn't overlap. Unfortunately, this may not help if you need active focus on the control.
  2. 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.
  3. 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
+3  A: 

What you need is the Graphics Debugger visualizer.

Kris Erickson
cool. thanks for the visualizer
Benny