OnPaint when using Offscreen bitmap

M

mBird

I am using an offscreen bitmap and I have scrolling.
For now I DrawImage the entire offscreen bitmap -- but that is slow.
Could anyone please tell me how to only DrawImage the portion I need so it
will go faster.
Thank you!

For now I do:
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.TranslateTransform(
AutoScrollPosition.X, AutoScrollPosition.Y);
e.Graphics.DrawImage(offScreenBmp, 0, 0);
System.Drawing.Size s = new System.Drawing.Size();
s.Width = 0;
s.Height = 2100;
AutoScrollMinSize = s;
}
 
B

Bryan H. Haber[MSFT]

PaintEventArgs has a ClipRectangle property that contains the rectangle
that needs redrawing. You could use that.

Bryan Haber[MSFT]
NET Client QA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top