Hola a todos aqui les pongo un codigo que encontre en la web que sirve para ponerle un efecto al cerrar un formulario.
esto lo colocan en un modulo
Código:
Option Explicit
Private Const MODULE_NAME As String = "mdEfectos"
Type RECT
left As Long
top As Long
right As Long
bottom As Long
End Type
' x, y, nWidth, nHeight in pixels
Declare Function MoveWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal x As Long, _
ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, _
ByVal bRepaint As Long) As Long
Declare Function GetWindowRect Lib "user32.dll" (ByVal hwnd As Long, lpRect As RECT) As Long
Public Sub WipeEffect(frm As Form, lngOpt As Long, lngIncrement As Long)
On Error GoTo WipeEffect_Error
Dim r As RECT
Dim lngRet As Long
Dim lngX As Long
Dim lngFormHeight As Long
Dim lngFormWidth As Long
Dim lngIncrementW As Long
Dim lngIncrementH As Long
lngRet = GetWindowRect(frm.hwnd, r)
lngFormWidth = r.right - r.left
lngFormHeight = r.bottom - r.top
lngIncrementW = lngFormWidth \ lngIncrement
lngIncrementH = lngFormHeight \ lngIncrement
Select Case lngOpt
Case 1 ' wipe up
For lngX = 1 To lngIncrement
lngRet = MoveWindow(frm.hwnd, r.left, r.top, _
lngFormWidth, lngFormHeight - lngX * lngIncrementH, 1)
Next lngX
Case 2 ' wipe down
For lngX = 1 To lngIncrement
lngRet = MoveWindow(frm.hwnd, r.left, r.top + lngX * lngIncrementH, _
lngFormWidth, lngFormHeight - lngX * lngIncrementH, 1)
Next lngX
Case 3 ' wipe right
For lngX = 1 To lngIncrement
lngRet = MoveWindow(frm.hwnd, r.left + lngX * lngIncrementW, r.top, _
lngFormWidth - lngX * lngIncrementW, lngFormHeight, 1)
Next lngX
Case 4 ' wipe left
For lngX = 1 To lngIncrement
lngRet = MoveWindow(frm.hwnd, r.left, r.top, _
lngFormWidth - lngX * lngIncrementW, lngFormHeight, 1)
Next lngX
Case 5 ' shrink/move
For lngX = 1 To lngIncrement
lngRet = MoveWindow(frm.hwnd, r.left - lngX * lngIncrementW, _
r.top + lngX * lngIncrementH, _
lngFormWidth - lngX * lngIncrementW, _
lngFormHeight - lngX * lngIncrementH, 1)
Next lngX
Case Else ' shiver
Dim lngTop As Long
Dim lngLeft As Long
Dim factor As Long
factor = 30
For lngX = 1 To 2500
If lngX Mod 4 = 0 Then
lngLeft = r.left - factor
lngTop = r.top - factor
ElseIf lngX Mod 3 = 0 Then
lngLeft = r.left - factor
lngTop = r.top + factor
ElseIf lngX Mod 2 = 0 Then
lngLeft = r.left + factor
lngTop = r.top - factor
Else
lngLeft = r.left + factor
lngTop = r.top + factor
End If
lngRet = MoveWindow(frm.hwnd, _
lngLeft, _
lngTop, _
lngFormWidth, _
lngFormHeight, 1)
Next lngX
MsgBox "Error.", vbCritical, "Code"
End Select
WipeEffect_Done:
Exit Sub
WipeEffect_Error:
'Call SysException.error(MODULE_NAME, "WipeEffect")
Resume WipeEffect_Done
End Sub Esto va en el boton de cerrar el formulario para llamar al funcion
Código:
Private Sub cmdSalir_Click()
Dim lngOpt As Long
Dim lngIncrement As Long
'para que el efecto sea diferente
lngOpt = Int(Rnd * 5) + 1
If lngOpt >= 0 Then
'velocidad del efecto
lngIncrement = 100
Call WipeEffect(Me, lngOpt, lngIncrement)
End If
Unload Me
End Sub saludos desde cancun espero y les guste y el saquen provecho para obtener aplicaciones muy atractivas.