Tutor membuat Form transparan seperti gambar berikut:
Bahan:
1. Buat 1 Form
2. Buat 1 Module
3. Buat 1 Timer
4. Buat 3 Label
5. Buat 1 Gambar
Source Code Form1:
Private Sub Form_Initialize()
Call SetTransparency(Me.hWnd, Me.BackColor)
End Sub
Private Sub Label1_Click()
End
End Sub
Private Sub Timer1_Timer()
If Label3.Visible = False Then
Label3.Visible = True
Else
Label3.Visible = False
End If
End Sub
End Sub
Private Sub Label1_Click()
End
End Sub
Private Sub Timer1_Timer()
If Label3.Visible = False Then
Label3.Visible = True
Else
Label3.Visible = False
End If
End Sub
Source Code Module1:
Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
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
Sub SetTransparency(piHwnd As Long, piColor As OLE_COLOR)
Const G_E = &HFFEC
Const W_E = &H80000
Const LW_KEY = &H1
SetWindowLong piHwnd, G_E, GetWindowLong(piHwnd, G_E) Or W_E
SetLayeredWindowAttributes piHwnd, piColor, 0, LW_KEY
End Sub
0 komentar:
Posting Komentar