Form Efekti - Yava癟a Kaybolan Formlar

Visual basic programlar覺n覺za çok ahane bir kaybolan form efekti.Kodlar sayesinde formunuzu transparanlat覺r覺p kapatabilir yada yavaça netletirebilirsiniz.... VB'yi aç覺n ve bir form daha ekleyin.Yani Form1 ve Form2 Olmal覺.Form1 üzerine bir adet Timer nesnesi ekleyin ve aa覺daki kodlar覺 içine yap覺t覺r覺n. 襤yi elenceler...

 

 

 

 

 

 

 

 

 

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 


Etiketler: Visual Basic

1 yorum

  • Yorumunuz en az 30 karakter olmal覺d覺r. (0)
    T羹m Yorumlar
    • mavana

      çal覺覺yor mu

      Yan覺tla