B
Ben Voigt
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.
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.