Hi.
Can someone tell me why this doesn't work?
I would expect the end result to be all red, but nothing happens.
If I remove the source bitmap and graphics object and just use "hdcSrc=GetDC(0)" then I get a screenshot, so I know the BitBlt function works.
It appears that the BitBlt function can't copy from one memory image to another.
So, can anyone answer this:
Are there any problems BitBlt'ing two memory images? Or does it have to be real physical devicecontexts?
VB Code:
Dim bmpDst, bmpSrc As Bitmap Dim grpDst, grpSrc As Graphics Dim hdcDst, hdcSrc As IntPtr bmpDst = New Bitmap(Panel1.ClientRectangle.Width, Panel1.ClientRectangle.Height) bmpSrc = New Bitmap(Panel1.ClientRectangle.Width, Panel1.ClientRectangle.Height) grpDst = Graphics.FromImage(bmpDst) grpSrc = Graphics.FromImage(bmpSrc) grpDst.Clear(Color.Black) grpSrc.Clear(Color.Red) grpSrc.Flush() hdcDst = grpDst.GetHdc hdcSrc = grpSrc.GetHdc Win32.Declarations.BitBlt(hdcDst, 0, 0, bmpDst.Width, bmpDst.Height, hdcSrc, 0, 0, Win32.Constants.BitBltConstants.SRCCOPY) grpSrc.ReleaseHdc(hdcSrc) grpDst.ReleaseHdc(hdcDst) grpSrc.Dispose() grpDst.Dispose() e.Graphics.DrawImage(bmpDst, 0, 0) bmpDst.Dispose() bmpSrc.Dispose()
Thanks


Reply With Quote
