Info Pendidikan Bogor

Info | Silabus | Pendidikan | Dunia IT | Bogor | Komputer | Manajemen

Form Transparant (VB)

Tips kali ini adalah bagaimana Membuat Form Transparant dengan Visual Basic, disini kita menggunakan Fungsi API yaitu GetWindowLong, SetWindowLong dan SetLayeredWindowAttributes. Saya rasa tidak perlu penjelasan yang detail untuk hal ini sobat bisa langsung melihat penampakannya dibawah ini

Bagaimana dengan Codingnya ikuti Langkah – Langkah Berikut :

Buat Project Baru Standart Exe
Ketik Coding dibawah ini pada Form Project Sobat

Option Explicit

Private Const WS_EX_LAYERED = &H80000
Private Const GWL_EXSTYLE = (-20)
Private Const LWA_COLORKEY = &H1
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 crColor As Long, ByVal nAlpha As Byte, ByVal dwFlags As Long) As Long

Private Sub Form_Load()
Call SetWindowLong(Me.hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED)
Call SetLayeredWindowAttributes(Me.hwnd, RGB(255, 0, 255), 128, LWA_ALPHA Or LWA_COLORKEY)
End Sub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Information

This entry was posted on June 4, 2012 by in Visual Basic and tagged .
%d bloggers like this: