Hallo Oly,
habe mal einige Foren durchsucht, etwas gefunden und den kompletten Code noch mal neu überarbeitet.
' FORM UNTEN RECHTS ÜBER SYSTRAY EIN UND AUSBLENDEN (TRANSPARENT)
'
' Kleine Form erstellen, BorderStyle auf 1 setzen und
' Komponente "Microsoft SysInfo Control ..." einfügen.
' ******************************************
Private Declare Function SetLayeredWindowAttributes Lib "user32.dll" _
(ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, _
ByVal dwFlags As Long) As Long
Private Declare Function GetWL Lib "user32" Alias "GetWindowLongA" _
(ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWL Lib "user32" Alias "SetWindowLongA" _
(ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNL As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Const WS_L = &H80000
Private Const GW_E = -20
Private Const LWA_1 = &H2
Private Const LWA_2 = &H1
Public Function SetTrans(ByRef tForm As Form, _
ByVal iTrans As Byte, Optional ByVal iTune As Boolean = True) As Boolean
On Error Resume Next
Dim LWL As Long
Err = 0
If iTune Then
LWL = GetWL(tForm.hwnd, GW_E)
LWL = LWL Or WS_L
SetWL tForm.hwnd, GW_E, LWL
End If
SetLayeredWindowAttributes tForm.hwnd, RGB(255, 0, 255), iTrans, LWA_1 Or _
LWA_2
SetTrans = Err = 0
End Function
Private Sub Form_Load()
Dim iMinTop As Long
Dim iMaxTop As Long
' POSITIONEN UND TOP-WERTE FESTLEGEN (unten rechts über SysTray)
With SysInfo1
' Left-Position der Form im WorkArea festlegen
Me.Left = .WorkAreaWidth + .WorkAreaLeft - (.WorkAreaWidth / 100) - Me.Width
' Soll und Ist-Top-Werte der Form im WorkArea festlegen
Me.Top = .WorkAreaHeight + .WorkAreaTop + 300
iMinTop = Me.Top
iMaxTop = Me.Top - Me.Height - (.WorkAreaHeight / 80) - 300
End With
' Form anzeigen
Me.Show
SetTrans Me, 150, True ' Transparenz der Form festlegen (Wert zwischen
' 0=unsichtbar und 255=sichtbar)
'FORM EINBLENDEN
' so lange die Form ihre obere Top-Position nicht erreicht hat
While iMaxTop < Me.Top
' wird diese stückweise eingeblendet
Me.Top = Me.Top - 15
Me.Refresh
Sleep 3
Wend
' Verweilzeit der Form (Millisekunden)
Sleep 4000
'FORM AUSBLENDEN
' so lange die Form ihre untere Top-Position nicht erreicht hat
While iMinTop > Me.Top
' wird diese stückweise ausgeblendet
Me.Top = Me.Top + 15
Me.Refresh
Sleep 3
Wend
Unload Me
End
End Sub Hattest Glück, dass ich gerade etwas Zeit hatte um Dir das zu machen.
Gruß JAG
Ansonsten wie Konfuzius schon sagte:
"Fordere viel von dir selbst und erwarte wenig von anderen. So wird dir Ärger erspart bleiben." |