Re: update graphics between debugger stepping
- From: "Ben Voigt" <rbv@xxxxxxxxxxxxx>
- Date: Fri, 1 Sep 2006 14:28:31 -0500
"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
.
- References:
- Re: update graphics between debugger stepping
- From: Carl Daniel [VC++ MVP]
- Re: update graphics between debugger stepping
- Prev by Date: Hilarious error message
- Next by Date: Re: Hilarious error message
- Previous by thread: Re: update graphics between debugger stepping
- Next by thread: RE: update graphics between debugger stepping
- Index(es):
Relevant Pages
|