Ciao stejano,
potresti fare sì che all'avvio la prima Form si materializzi e visualizzi progressivamente un'immagine, con le intestazioni del programma (ad esempio il nome, versione, ecc.) che scorrono.
Effetto contrario alla chiusura del programma con la Form che si dematerializza. Ti posto un esempio. Inserisci in una Frm un controllo Image di grandezza simile alla Frm, due Lbl ed un CmdButton:
codice:
' Nel modulo della Form:
Option Explicit
Dim sglSZ As Single
Dim sglSZ2 As Single
'------------------------------------------------------
Private Sub Form_Load()
' Stabilisce le dimensioni della Frm:
With Form1
.Top = 0
.Left = 0
.Height = 11520
.Width = 15360
End With
' Carica Immagine Sfondo - File di risorse:
Set Form1.Image1.Picture = LoadResPicture(101, vbResBitmap)
With Form1.Image1
.Top = 100
.Left = 100
.Height = 10620
.Width = 14880
End With
Dim t As Single
' Proprietà della Label con testo scorrevole:
With Label1
.AutoSize = True
.WordWrap = False
.Caption = "Prova di materializzazione della Form "
sglSZ = .Width
End With
With Label2
.AutoSize = True
.WordWrap = False
.Caption = "Prova 2 di materializzazione della Form "
sglSZ2 = .Width
End With
' La Frm si materializza ed il testo scorre:
For t = 0 To 254 Step 15
FormFade Form1, t
Label1.Width = (t * (sglSZ / 255))
Label2.Width = (t * (sglSZ2 / 255))
Next t
't = Opacity = Max 255
Form1.Refresh
Form1.Image1.Refresh
End Sub
'------------------------------------------------------
Private Sub Command1_Click()
Dim p As Single
' La Frm si Dematerializza ed il testo scorre:
For p = 0 To 254 Step 15
FormFade Form1, (255 - p)
Label1.Width = sglSZ - (p * (sglSZ / 255))
Label2.Width = sglSZ2 - (p * (sglSZ2 / 255))
Next p
' Chiude la Frm:
End
End Sub
codice:
'In un modulo Bas:
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
Ricordati in fine di caricare l'immagine nel file di Risorse.