Hi guys, I'm currently using this to make my form semi-transparent. and it's working fine, for it's meant to be used for.
But I now need to be able to control the transparency of the form and the controls separately, rather than all in one. Anyone got any ideas?Code:Option Explicit Private Const GWL_EXSTYLE = (-20) Private Const WS_EX_LAYERED = &H80000 Private Const LWA_ALPHA = &H2 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 Public Function TransForm(Form As Form, TransLevel As Byte) As Boolean SetWindowLong Form.hWnd, GWL_EXSTYLE, WS_EX_LAYERED SetLayeredWindowAttributes Form.hWnd, 0, TransLevel, LWA_ALPHA TransForm = Err.LastDllError = 0 End Function Private Sub Form_Load() TransForm Me, 200 End Sub
Syrillia




Reply With Quote