Form Efekti - Yavaşça Kaybolan Formlar
28.11.2008 02:16 — Visual Basic, Visual basic programlarınıza çok ÅŸahane bir kaybolan form efekti.Kodlar sayesinde formunuzu transparanlaÅŸtırıp kapatabilir yada yavaÅŸça netleÅŸtirebilirsiniz.... VB'yi açın ve bir form daha ekleyin.Yani Form1 ve Form2 Olmalı.Form1 üzerine bir adet Timer nesnesi ekleyin ve aÅŸağıdaki kodları içine yapıştırın. İyi eÄŸlenceler...
Option Explicit
Dim Trans As Integer
Private Const LWA_COLORKEY = 1
Private Const LWA_ALPHA = 2
Private Const LWA_BOTH = 3
Private Const WS_EX_LAYERED = &H80000
Private Const GWL_EXSTYLE = -20
Private Declare Function SetLayeredWindowAttributes Lib "user32" _
(ByVal hwnd As Long, ByVal color As Long, ByVal x As Byte, _
ByVal alpha As Long) As Boolean
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 GetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Sub SetTrans(hwnd As Long, Trans As Integer)
Dim Tcall As Long
Tcall = GetWindowLong(hwnd, GWL_EXSTYLE)
SetWindowLong hwnd, GWL_EXSTYLE, Tcall Or WS_EX_LAYERED
SetLayeredWindowAttributes hwnd, RGB(255, 255, 0), Trans, LWA_ALPHA
Exit Sub
End Sub
Private Sub Form_Load()
Form2.Show
Form2.Enabled = False
Timer1.Interval = 1
Trans = 255
SetTrans Me.hwnd, Trans
End Sub
Private Sub Timer1_Timer()
If Trans <> 0 Then
Trans = Trans - 1
End If
SetTrans Me.hwnd, Trans
If Trans = 0 Then
Form2.Enabled = True
Unload Me
End If
End Sub


