Kamis, 16 Mei 2013

MEMBUAT FORM TRANSPARAN VB 6

Membuat Form Transparan VB 6 (Session 1)

Ada kala kita membutuhkan Form yang transfaran atau tembus pandang. Gimanakah cara
membikinnya, berikut tip-tip:

Buat form baru dan satu buah module,
ketik listing berikut pada form:

Private Sub Form_Initialize()
'Ketranfaranan From yakni 0 - 255
TranslucentForm Me, 100
End Sub

Tambahkan module, Ketik listing berikut pada module:
Option Explicit
Public Const GWL_EXSTYLE = (-20)
Public Const WS_EX_LAYERED = &H80000
Public Const LWA_ALPHA = &H2
Public Const EM_GETLINECOUNT = &HBA
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA"(ByVal hWnd As_
Long, ByVal nIndex As Long) As Long
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 SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long,_
ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As
Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Function TranslucentForm(frm As Form, TranslucenceLevel As Byte) As Boolean
SetWindowLong frm.hWnd, GWL_EXSTYLE, WS_EX_LAYERED
SetLayeredWindowAttributes frm.hWnd, 0, TranslucenceLevel, LWA_ALPHA
TranslucentForm = Err.LastDllError = 0
End Function

0 komentar:

Posting Komentar

CopyRyght@2012 | Facebook | Twitte | Bloger | Google