Hi - Perhaps this has been answered before, but I couldn't find a solution in a thread search...
I am trying to create a bitmap in memory to blit another bitmap onto.
The memory bitmap needs to have its back colour set to match a transparent colour in the source image.
Does anyone know how to create a memory bitmap DC using a specific colour.
This is not working:
Dim hBitmap As Long
Dim DC As Long
DC = CreateCompatibleDC(0&)
hBitmap = CreateCompatibleBitmap(DC, 500, 500)
SelectObject DC, hBitmap
SetBkMode DC, OPAQUE
SetBkColor DC, vbRed
SetStretchBltMode Picture1.hdc, STRETCH_HALFTONE
Call StretchBlt(Picture1.hdc, 0, 0, 200, 200, _
DC, 0, 0, 500, 500, SRCCOPY)
I would like this to add a 200x200 red rectangle to the picturebox. (If I can get this to work, I will blit my transparent image onto the DC before the final StretchBlt'ing is done).
Thanks, - Ron
I am trying to create a bitmap in memory to blit another bitmap onto.
The memory bitmap needs to have its back colour set to match a transparent colour in the source image.
Does anyone know how to create a memory bitmap DC using a specific colour.
This is not working:
Dim hBitmap As Long
Dim DC As Long
DC = CreateCompatibleDC(0&)
hBitmap = CreateCompatibleBitmap(DC, 500, 500)
SelectObject DC, hBitmap
SetBkMode DC, OPAQUE
SetBkColor DC, vbRed
SetStretchBltMode Picture1.hdc, STRETCH_HALFTONE
Call StretchBlt(Picture1.hdc, 0, 0, 200, 200, _
DC, 0, 0, 500, 500, SRCCOPY)
I would like this to add a 200x200 red rectangle to the picturebox. (If I can get this to work, I will blit my transparent image onto the DC before the final StretchBlt'ing is done).
Thanks, - Ron