Ive searched on the forums, and havent found what i needed. Ive been working on an mp3 player, and am basically done with it, but forgot about the whole transparent form part of it. I have everything but the controls as one picture, the forms picture, is there a way to just take one color of it and make it transparent? Or will i have to go back to bitblt, or setwindowlong or something?
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
oops, sorry, i used the wrong terms, I want to mask a color on the forms picture to be transparent. Thanks for the alpha blending tips though, that will also come in handy.
Also if you would like to apply that sort of thing to a form you can pass an RGB colour key value to the SetLayeredWindowAttributes API call and then only pixels of that colour on your form will be drawn alpha-blended.
e.g.
VB Code:
' LWA_COLORKEY = &H1
SetLayeredWindowAttributes Me.hWnd, RGB(0, 0, 0), 100, LWA_ALPHA Or LWA_COLORKEY