Bagi teman - teman yang ingin membuat tampilan Form transparan pada VB 6.0 seperti diatas, silahkan Copy-Paste Code yang telah Saya sederhanakan dibawah ini :
Option Explicit
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Const LWA_ALPHA = &H2
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
Private Declare Function SetLayeredWindowAttributes Lib _
"user32" (ByVal hWnd As Long, ByVal crKey As Long, _
ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Public Function TransForm(Form As Form, TransLevel As Byte) As Boolean
SetWindowLong Form.hWnd, GWL_EXSTYLE, WS_EX_LAYERED
SetLayeredWindowAttributes Form.hWnd, 0, TransLevel, LWA_ALPHA
TransForm = Err.LastDllError = 0
End Function
Private Sub Form_Load()
Load PutraQincay
TransForm PutraQincay, 200
End Sub
Code diatas bisa dibikin dalam satu Form atau ditambah dengan menggunakan Module Copy-Paste pada Module Code dibawah ini :
Option Explicit
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Const LWA_ALPHA = &H2
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
Private Declare Function SetLayeredWindowAttributes Lib _
"user32" (ByVal hWnd As Long, ByVal crKey As Long, _
ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Public Function TransForm(Form As Form, TransLevel As Byte) As Boolean
SetWindowLong Form.hWnd, GWL_EXSTYLE, WS_EX_LAYERED
SetLayeredWindowAttributes Form.hWnd, 0, TransLevel, LWA_ALPHA
TransForm = Err.LastDllError = 0
End Function
Untuk di Form kamu Copy-Paste code ini :
Private Sub Form_Load()
Load PutraQincay
TransForm PutraQincay, 200
End Sub
Yang perlu diperhatikan pada sa'at menjalankan Program, kamu harus mengganti Nama Form pada Preperties - -> Name dan untuk nilai Transparannya kamu bisa mengganti Nilai 200. Bisa dari Nilai 0 s/d 250. Selamat Mencoba teman-teman...
Option Explicit
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Const LWA_ALPHA = &H2
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
Private Declare Function SetLayeredWindowAttributes Lib _
"user32" (ByVal hWnd As Long, ByVal crKey As Long, _
ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Public Function TransForm(Form As Form, TransLevel As Byte) As Boolean
SetWindowLong Form.hWnd, GWL_EXSTYLE, WS_EX_LAYERED
SetLayeredWindowAttributes Form.hWnd, 0, TransLevel, LWA_ALPHA
TransForm = Err.LastDllError = 0
End Function
Private Sub Form_Load()
Load PutraQincay
TransForm PutraQincay, 200
End Sub
Code diatas bisa dibikin dalam satu Form atau ditambah dengan menggunakan Module Copy-Paste pada Module Code dibawah ini :
Option Explicit
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Const LWA_ALPHA = &H2
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
Private Declare Function SetLayeredWindowAttributes Lib _
"user32" (ByVal hWnd As Long, ByVal crKey As Long, _
ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Public Function TransForm(Form As Form, TransLevel As Byte) As Boolean
SetWindowLong Form.hWnd, GWL_EXSTYLE, WS_EX_LAYERED
SetLayeredWindowAttributes Form.hWnd, 0, TransLevel, LWA_ALPHA
TransForm = Err.LastDllError = 0
End Function
Untuk di Form kamu Copy-Paste code ini :
Private Sub Form_Load()
Load PutraQincay
TransForm PutraQincay, 200
End Sub
Yang perlu diperhatikan pada sa'at menjalankan Program, kamu harus mengganti Nama Form pada Preperties - -> Name dan untuk nilai Transparannya kamu bisa mengganti Nilai 200. Bisa dari Nilai 0 s/d 250. Selamat Mencoba teman-teman...
No comments:
Post a Comment
Kepada para teman Putra Qincay. Silahkan tinggalkan komentar teman disini ya!!!...