Join the forum, it's quick and easy

Would you like to react to this message? Create an account in a few clicks or log in to continue.

    Membuat Form Transparant

    CYBER
    CYBER
    CO - Admin
    CO - Admin


    Male
    Thread & Post : 215
    Point Forum : 565637
    Thanks Given : 4034
    Join date : 05.08.11
    Age : 34
    Lokasi : S-N-U-T-Z-E-R

    Membuat Form Transparant Empty Membuat Form Transparant

    Post by CYBER Thu Aug 11, 2011 6:01 am

    Untuk membuat form transparan di vb 6 ikuti caranya :

    Buat sebuah form contoh di sini form1 kemudian buat juga sebuah module yang di sini namanya module1, kalau sudah masukkan script pada module1 seperti di bawah ini biar gampang cukup copy dan pastekan pada jendela code module1

    Code:

    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

    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

    Public Sub SetLayeredWindow(ByVal hwnd _
    As Long, ByVal bIslayered As Boolean)
    Dim WinInfo As Long
    WinInfo = GetWindowLong(hwnd, -20)
    If bIslayered = True Then
    WinInfo = WinInfo Or 524288
    Else
    WinInfo = WinInfo And Not 524288
    End If
    SetWindowLong hwnd, -20, WinInfo
    End Sub

    Public Sub SetTransparan(ByVal hwnd _
    As Long, ByVal Opacity As Byte, _
    IsTransparent As Boolean)
    If IsTransparent = True Then
    SetLayeredWindow hwnd, True
    SetLayeredWindowAttributes hwnd, _
    0, Opacity, 2
    ElseIf IsTransparent = False Then
    SetLayeredWindow hwnd, False
    End If
    End Sub

    Kemudian buka windows code atau biar gambang cukup klik 2x pada form1 tepatnya pada Object form Procedur Load dan masukkan script yang di bawah:

    Code:

    Private Sub Form_Load()
    SetTransparan Me.hwnd, 200, True
    End SubUntuk merubah kualitas dari transparan form ganti nilai 200 sesuai dengan keingingan anda

      Waktu sekarang Fri May 17, 2024 9:48 am