TransparentBitBlt to Frame
Is it possible to do a BitBlt/TransparentBitBlt to a Frame? Apparently, when I call TransparentBitBlt, it returns TRUE, but the image never appears on the screen.
VB Code:
Dim hBitmap As Long
Dim hDc As Long
Dim hFraDc As Long
' Preparing the image
hDc = CreateCompatibleDC(GetDC(0))
hFraDc = CreateCompatibleDC(GetDC(Fra.hwnd))
hBitmap = LoadImage(App.hInstance, App.Path & "\Images\po00.bmp", IMAGE_BITMAP, 64, 64, LR_LOADFROMFILE)
SelectObject hDc, hBitmap
MsgBox CStr(TransparentBlt(hFraDc, 5, 5, 64, 64, hDc, 0, 0, 64, 64, vbWhite)) ' <-- Returns TRUE
Me.Refresh
DeleteObject hBitmap
Re: TransparentBitBlt to Frame
I hope sample I posted in this thread is what you looking for.
Re: TransparentBitBlt to Frame
Quote:
Originally Posted by RhinoBull
I hope sample I posted in
this thread is what you looking for.
Thanks for the assistance.
Unfortunately, according to this post, I'm up a creek because of special funkiness that is the Common Controls Frame. Even if I get it to paint--which I haven't yet--it appears that I'm going to run into the wall that is a Frame's Lack of AutoRedraw property. Can anyone confirm these comments?
[EDIT]
I've confirmed this information. If I create a button with my BitBlt functionality and click it, the image will appear in the frame. However, as soon as I do something as much as move my mouse over the frame, the image will disappear. :sick:
Re: TransparentBitBlt to Frame
That post proves nothing really so I don't necessary agree with everything said in there:
Quote:
Originally Posted by moeur
The frame control is a lightweight control, it has no hWnd or Device Context...
Frame control is not lightweight - it's a container which can only be a window so it has a handle (hWnd property).
It doesn't have Device Context but you can get it using GetDC api as shown in my sample:
TempDC = GetDC(Frame1.hWnd)
My sample is just a quick demonstration of how can this (trans frame simulation) be achieved - you will have to go beyond that and perhaps subclass some messages so you can implement some kind of refresh (or redraw if you will).
Best of luck.