I posted it above but here it is again. This code makes a colour on a form totally transparent where you see through the form. I want the exact same effect but this time, you see throught the control like shown in the pictures above.
Private Declare Function SetWindowLongptr 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
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const GWL_EXSTYLE = (-20) ' Transparent color
Private Const GWL_STYLE = (-16) ' Expandable borders
Private Const WS_EX_LAYERED = &H80000
Private Const WS_EX_TRANSPARENT = &H20
Private Const WS_EX_APPWINDOW = &H40000
Private Const LWA_ALPHA = &H2
Private Const LWA_COLORKEY = &H1
Private Const COL_TRANS = &HFF ' Transparent Red
Private Sub Form_Load()
Dim Alpha As Byte
Dim MaskColour As Long
Alpha = 200
MaskColour = COL_TRANS
' Whatever control you want to make the backcolor transparent
' Set the backcolor to the transparent color
Picture1.BackColor = MaskColour
Option1.BackColor = MaskColour
Check1.BackColor = MaskColour
Me.BackColor = MaskColour
Text1.BackColor = MaskColour
Command1.BackColor = MaskColour
' Apply Transparency
SetWindowLongptr Me.hwnd, GWL_EXSTYLE, WS_EX_LAYERED Or WS_EX_APPWINDOW
SetLayeredWindowAttributes Me.hwnd, MaskColour, Alpha, LWA_COLORKEY ' Or LWA_ALPHA
Yesterday, I found/modified code that did nearly exactly what you wanted except that the area of the picture box you could click through. Meaning that the form did not recieve any mousemove or click events. Also as part of this description, if the picture boxes zorder=0 then it would also bore holes through any control behind it and in reverse, other controls would hide portions of the picturebox so you would get a funny shaped hole in your form.
I searched several sites yesterday in hopes of answering your question, and the best I can come up with is that user control or use a seperate form for your effect.
However, if you find another way, please post the code.
I have tried everything that you guys posted here and I got no solution. It IS indeed a hard thing to do and find on the net. Before posting here, I searched a lot on Internet and tried to find a way to do this.
I did not want to use a UserControl because of all then hassle of programming it's parameters to set up the effect I wanted but it seems impossible for now to have the effect wanted with a simple PictureBox.
I want to thank everyone who has tried to help at its best to find a solution to this problem. I'm probably sure that this post will be way back in pages after this but at least, if it's contents can help someone else than at least no-one help for nothing.