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:
  1. Dim bmpDst, bmpSrc As Bitmap
  2.         Dim grpDst, grpSrc As Graphics
  3.         Dim hdcDst, hdcSrc As IntPtr
  4.  
  5.         bmpDst = New Bitmap(Panel1.ClientRectangle.Width, Panel1.ClientRectangle.Height)
  6.         bmpSrc = New Bitmap(Panel1.ClientRectangle.Width, Panel1.ClientRectangle.Height)
  7.  
  8.         grpDst = Graphics.FromImage(bmpDst)
  9.         grpSrc = Graphics.FromImage(bmpSrc)
  10.  
  11.         grpDst.Clear(Color.Black)
  12.         grpSrc.Clear(Color.Red)
  13.         grpSrc.Flush()
  14.  
  15.         hdcDst = grpDst.GetHdc
  16.         hdcSrc = grpSrc.GetHdc
  17.  
  18.         Win32.Declarations.BitBlt(hdcDst, 0, 0, bmpDst.Width, bmpDst.Height, hdcSrc, 0, 0, Win32.Constants.BitBltConstants.SRCCOPY)
  19.  
  20.         grpSrc.ReleaseHdc(hdcSrc)
  21.         grpDst.ReleaseHdc(hdcDst)
  22.  
  23.         grpSrc.Dispose()
  24.         grpDst.Dispose()
  25.  
  26.         e.Graphics.DrawImage(bmpDst, 0, 0)
  27.  
  28.         bmpDst.Dispose()
  29.         bmpSrc.Dispose()

Thanks