نكتب فى قسم التصريحات
رمز:
Private Declare Function SetLayeredWindowAttributes Lib "user32.dll" (ByVal hwnd As Long, ByValcrKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Boolean
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 GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Const LWA_ALPHA = 2
Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = &H80222
Private Declare Sub SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
ثم نختر فى أمر اللود
رمز:
Private Sub Form_Load()
SetWindowLong hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED
SetLayeredWindowAttributes hwnd, 0, 150, LWA_ALPHA
Timer1.Interval = 1
End Sub
ثم نضع 4 labelوفى الثالثة نضع الساعة الآن و الرابعة التاريخ
رمز:
Private Sub Label4_Click()
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Time
Label2.Caption = Date
SetWindowPos Form1.hwnd, -1, 0, 0, 0, 0, 3
End Sub