Re: update graphics between debugger stepping




"Carl Daniel [VC++ MVP]" <cpdaniel_remove_this_and_nospam@xxxxxxxxxxxxxxx>
wrote in message news:uFrpjyXzGHA.1536@xxxxxxxxxxxxxxxxxxxxxxx
Ben Voigt wrote:
Ok, while troubleshooting painting code, I am trying to see my canvas
after each step. My OnPaint handler ultimately updates the screen
with: pe.Graphics.DrawImageUnscaled(bmpCanvas, -scrollOffset.X,
-scrollOffset.Y);
So I tried writing the following, and calling it from the watch window
and/or debug window:
internal void BlitNow()
{
using (Graphics g = CreateGraphics())
{
g.FillRectangle(Brushes.Red, new Rectangle(0, 0, 500, 500));
g.DrawImageUnscaled(bmpCanvas, -scrollOffset.X, -scrollOffset.Y);
g.Flush();
}
}

Doesn't do a thing. Why? Tried entering this in the watch window:
g = CreateGraphics()

Inspect g, VisibleClipBounds is {X = 0.0 Y = 0.0 Width = 339.0 Height
= 537.0}
g.FillRectangle(Brushes.Green, g.VisibleClipBounds)
g.Flush()

Nothing happens. I think at this point my entire control should be
green. Where is .NET buffering my output and what method do I call to
force .NET to show me immediately? I am not using the DoubleBuffered
or OptimizedDoubleBuffering control style flags, since I manage my own
off-screen buffer.

I don't know if it's relevant to the issue you're encountering, but... one
very useful technique for debugging paint routines is to run your
application on a VPC on your workstation and use remote debugging to debug
it. This works best on a dual monitor system with the VPC maximized on one
monitor and visual studio maximized on the other. That way your
application and the debugger are running on different desktops and the
debugger coming into focus doesn't actually invalidate your application's
window(s).

I have dual monitors, so the form is not covered by the debugger, so it's
not being invalidated.


-cd




.



Relevant Pages

  • Strange debugger problem
    ... This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention. ... So hopefully the error is in the debugger, ... If I take m_pProblem->LowerBoundout of the watch window then the program stops and restarts quietly. ...
    (microsoft.public.vc.language)
  • Re: boost::variant and VC debugger
    ... The only issue is that i haven't yet found a way to use the debugger to ... window to show a value (the command window looks less powerful than the ... This contains operator, but it is inline, so the debugger cannot display, for example, x. ... But I know that the internal buffer is named v, and if I type x.vin the watch window, then the value is displayed. ...
    (microsoft.public.vc.language)
  • Re: API
    ... Use the Watch window or the Locals window. ... Every visual debugger I've ever used, ... and then set the terminating null character to complete the string. ...
    (microsoft.public.windowsce.app.development)
  • RE: debugger IDE hangs when stepping with properties in watch window
    ... If you put local variables in the ... it will take debugger very long time to resolve these ... Since you put these variables in watch window ...
    (microsoft.public.vsnet.debugging)