Lompat ke konten Lompat ke sidebar Lompat ke footer

Animasi Form iN / Out

copas sCript ini di Notepad..dan save as kasih nama form1.frm

Terus Jalanin deh..

VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command1
Caption = "Close"
Height = 615
Left = 1440
TabIndex = 1
Top = 240
Width = 1335
End
Begin VB.Frame Frame1
Caption = "Animate"
Height = 855
Left = 0
TabIndex = 0
Top = 120
Width = 1335
Begin VB.Timer tunload
Interval = 50
Left = 720
Top = 240
End
Begin VB.Timer tload
Interval = 50
Left = 120
Top = 240
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Const LWA_ALPHA = &H2
Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = &H80000

Dim Ret 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 crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Dim i As Long
Dim j As Long

Public Sub MakeTransparent(ByRef frm As Form, ByVal Alpha As Long)
Ret = GetWindowLong(frm.hwnd, GWL_EXSTYLE)
Ret = Ret Or WS_EX_LAYERED
SetWindowLong frm.hwnd, GWL_EXSTYLE, Ret
'change ipAlpha for transparency
SetLayeredWindowAttributes frm.hwnd, 0, Alpha, LWA_ALPHA
End Sub


Private Sub Command1_Click()
tunload.Enabled = True
End Sub

Private Sub Form_Load()
Call MakeTransparent(Me, 0)
i = 255
j = 0

tunload.Enabled = False

End Sub

Private Sub Form_Unload(Cancel As Integer)
Cancel = 1
MsgBox "gunakan tombol close untuk keluar dari program!!!", vbExclamation
End Sub

Private Sub tload_Timer()
If j < 260 Then Call MakeTransparent(Me, 0 + j) j = j + 10 Me.Enabled = False Else MakeTransparent Me, 255 tload.Enabled = False Me.Enabled = True End If End Sub Private Sub tunload_Timer() If i > 0 Then
Call MakeTransparent(Me, i)
i = i - 10
Else
End
End If

End Sub

Posting Komentar untuk "Animasi Form iN / Out"