Could someone post an example of how to draw on my form using BitBlt. Here is what I have so far:
that is done in the overriden OnPaint event. B is my Image.
I always get the error:
The object is currently in use elsewhere.
C#:
IntPtr offscreenDC= a.Api.CreateCompatibleDC(e.Graphics.GetHdc());
a.Api.SelectObject(offscreenDC, B.GetHbitmap());
a.Api.BitBlt(e.Graphics.GetHdc(), this.posRec.X, this.posRec.Y, this.posRec.Width, this.posRec.Height, offscreenDC, 0, 0, SrcCopy);
e.Graphics.ReleaseHdc(e.Graphics.GetHdc());
a.Api.DeleteDC(offscreenDC);
I always get the error:
The object is currently in use elsewhere.
Last edited by a moderator: