I am trying to draw a picture in a memory bitmap then bitblt it back to a picture box but all I get is a black image, does anyone have any idea what i'm doing wrong.
Code:testhnd = frmTest.PicTest.hDC ' Create a device context to hold the image. mem_dc = CreateCompatibleDC(testhnd) hBmp = CreateCompatibleBitmap(mem_dc, frmTest.PicTest.Width, frmTest.PicTest.Height) ' Select the bitmap into the device context. SelectObject mem_dc, hBmp 'Set colours res = SetBkMode(mem_dc, OPAQUE) res = SetBkColor(mem_dc, glWHITE) 'set pen lCustomPen = CreatePen(PS_SOLID, 1, glBLACK) res = SelectObject(mem_dc, lCustomPen) SelectObject mem_dc, GetStockObject(WHITE_BRUSH) ' Draw a rectangle res = Rectangle(mem_dc, 10,10,80,80) ' Copy the bitmap into picResult. BitBlt testhnd, 0, 0, frmTest.PicTest.Width, frmTest.PicTest.Height, _ mem_dc, 0, 0, SRCCOPY


Reply With Quote