Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/03/2012, 13:04
Avatar de haggenx
haggenx
 
Fecha de Ingreso: febrero-2007
Ubicación: México
Mensajes: 823
Antigüedad: 17 años, 9 meses
Puntos: 24
De acuerdo Aporte: Sacudir ventana tipo Mac OSX

Que tal:

Deseo aportar éste código fuente para crear un bonito efecto para nuestras aplicaciones, en mac osx al iniciar sesión si ingresamos la contraseña incorrecta la ventana de login se sacude, bueno he creado algo similar para nuestras ventanas en vb.net, podemos sacudir la ventana en forma horizontal o vertical y así simular el efecto descrito, espero les guste, saludos:


'#### Purpose: Earth quake in the window!!!!!!!!!!!
'#### Created date: 03/03/2012
'#### Created by username: Juan Manuel Mar Hdz.
'#### Last modified date: 10/03/2012
'#### Last modified username: Juan Manuel Mar Hdz.
'#### Thanks to http://www.forosdelweb.com/wiki/Efec...n_el_navegador
Public Sub drawFxEarthQuakeToWindow(window As Form, direction As Long, Optional times As Long = 3)

Select Case direction

Case 1:
xdirectionearthquake(window, 3)

Case 2:
ydirectionearthquake(window, 3)

Case Else:
xdirectionearthquake(window, 3)

End Select

End Sub

'#### Purpose: Earth quake in the window!!!!!!!!!!!
'#### Created date: 03/03/2012
'#### Created by username: Juan Manuel Mar Hdz.
'#### Last modified date: 10/03/2012
'#### Last modified username: Juan Manuel Mar Hdz.
'#### Inspired in http://www.forosdelweb.com/wiki/Efec...n_el_navegador
'#### Thanks to http://bytes.com/topic/visual-basic-...leep-5-minutes
Private Sub xdirectionearthquake(window As Form, times As Long)

Dim i As Long, j As Long, space As Long = 2, movetimes As Long = 4
Dim winleft As Long, sleeptime As Long = 25

winleft = window.Left

For j = 1 To times - 1

window.Left = winleft

For i = 1 To movetimes

My.Application.DoEvents
window.Left = window.Left + (i * space)
System.Threading.Thread.Sleep(sleeptime)

Next

For i = movetimes To 1 Step -1

My.Application.DoEvents
window.Left = window.Left - (i * space)
System.Threading.Thread.Sleep(sleeptime)

Next

For i = 1 To (-1 * movetimes) Step -1

My.Application.DoEvents
window.Left = window.Left - (i * space)
System.Threading.Thread.Sleep(sleeptime)

Next

For i = (-1 * movetimes) To 1

My.Application.DoEvents
window.Left = window.Left + (i * space)
System.Threading.Thread.Sleep(sleeptime)

Next

Next

End Sub

'#### Purpose: Earth quake in the window!!!!!!!!!!!
'#### Created date: 10/03/2012
'#### Created by username: Juan Manuel Mar Hdz.
'#### Last modified date: 10/03/2012
'#### Last modified username: Juan Manuel Mar Hdz.
'#### Inspired in http://www.forosdelweb.com/wiki/Efec...n_el_navegador
'#### Thanks to http://bytes.com/topic/visual-basic-...leep-5-minutes
Private Sub ydirectionearthquake(window As Form, times As Long)

Dim i As Long, j As Long, space As Long = 2, movetimes As Long = 4
Dim winleft As Long, sleeptime As Long = 25

winleft = window.Top

For j = 1 To times - 1

window.Top = winleft

For i = 1 To movetimes

My.Application.DoEvents
window.Top = window.Top + (i * space)
System.Threading.Thread.Sleep(sleeptime)

Next

For i = movetimes To 1 Step -1

My.Application.DoEvents
window.Top = window.Top - (i * space)
System.Threading.Thread.Sleep(sleeptime)

Next

For i = 1 To (-1 * movetimes) Step -1

My.Application.DoEvents
window.Top = window.Top - (i * space)
System.Threading.Thread.Sleep(sleeptime)

Next

For i = (-1 * movetimes) To 1

My.Application.DoEvents
window.Top = window.Top + (i * space)
System.Threading.Thread.Sleep(sleeptime)

Next

Next

End Sub