Results 1 to 4 of 4

Thread: TransparentBitBlt to Frame

  1. #1

    Thread Starter
    Hyperactive Member Fedhax's Avatar
    Join Date
    Aug 2006
    Posts
    293

    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:
    1. Dim hBitmap         As Long
    2.     Dim hDc             As Long
    3.     Dim hFraDc          As Long
    4.    
    5.     ' Preparing the image
    6.     hDc = CreateCompatibleDC(GetDC(0))
    7.     hFraDc = CreateCompatibleDC(GetDC(Fra.hwnd))
    8.    
    9.     hBitmap = LoadImage(App.hInstance, App.Path & "\Images\po00.bmp", IMAGE_BITMAP, 64, 64, LR_LOADFROMFILE)
    10.     SelectObject hDc, hBitmap
    11.  
    12.     MsgBox CStr(TransparentBlt(hFraDc, 5, 5, 64, 64, hDc, 0, 0, 64, 64, vbWhite))   ' <-- Returns TRUE
    13.     Me.Refresh
    14.  
    15.     DeleteObject hBitmap

  2. #2

  3. #3

    Thread Starter
    Hyperactive Member Fedhax's Avatar
    Join Date
    Aug 2006
    Posts
    293

    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.
    Last edited by Fedhax; Sep 20th, 2006 at 05:05 PM. Reason: Additional Information

  4. #4
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width