Langkah langkahnya yaitu sebagai berikut :
1. Tambahkan Module – kemudian ketik Script dibawah ini
(Untuk Di Module)
Option Explicit
Public Const LWA_COLORKEY = 1
Public Const LWA_ALPHA = 2
Public Const LWA_BOTH = 3
Public Const WS_EX_LAYERED = &H80000
Public Const GWL_EXSTYLE = -20
Public Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal warna As Long, ByVal X As Byte, ByVal alpha As Long) As Boolean
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Sub SetTransparan(frm As Long, warna As Long, nTrans As Integer, flag As Byte)
On Error GoTo Err
Dim attrib As Long
attrib = GetWindowLong(frm, GWL_EXSTYLE)
SetWindowLong frm, GWL_EXSTYLE, attrib Or WS_EX_LAYERED
SetLayeredWindowAttributes frm, warna, nTrans, flag
Exit Sub
Err:
MsgBox Err.Description & " Source : " & Err.Source
End Sub
2. Ketik Script dibawah ini pada Form yang menjadi target
(Untuk Di Form)
Option Explicit
Dim color As Long, flag As Byte
Private Sub Form_Activate()
On Error GoTo Err
color = vbBlue
flag = flag Or LWA_COLORKEY
SetTransparan Form1.hwnd, color, 0, flag
Exit Sub
Err: MsgBox Err.Description & " Source : " & Err.Source
End Sub
3. Setelah itu Pilih pada tampilan Properties
Form – pilih pada Backcolor-pilih palette
Kemudian pilih warna biru yang dilingkari
4 .Yang terakhir anda tinggal menjalankanya
Tekan F5
Tidak ada komentar:
Posting Komentar