Per dare la trasparenza alla form puoi usare la seguente funzione da inserire in un modulo bas:
Poi nel modulo della form la richiami così:codice:Option Explicit Private Const GWL_EXSTYLE = (-20) Private Const LWA_ALPHA = &H2 Private Const WS_EX_LAYERED = &H80000 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 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 '------------------------------------------------------------------ Public Sub FormFade(ByRef frmForm As Form, ByVal Opacity As Long) Dim Msg As Long frmForm.Show vbModeless Msg = GetWindowLong(frmForm.hwnd, GWL_EXSTYLE) Msg = Msg Or WS_EX_LAYERED SetWindowLong frmForm.hwnd, GWL_EXSTYLE, Msg SetLayeredWindowAttributes frmForm.hwnd, 0, Opacity, LWA_ALPHA frmForm.Refresh End Sub
codice:Option Explicit Private Sub Form_Load() Dim t As Single ' Imposta BorderStyle=0 ' Livello di trasparenza: t = 200 ' da 0 a 255 FormFade Form1, t End Sub![]()

Rispondi quotando