Mostrando entradas con la etiqueta botón no clickable. Mostrar todas las entradas
Mostrando entradas con la etiqueta botón no clickable. Mostrar todas las entradas

jueves, 15 de octubre de 2009

Botón escurridizo

Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
If btnExit.Left - e.X < 10 And btnExit.Left - e.X > 0 And e.Y - btnExit.Top _ < btnExit.Height Then
btnExit.Left += 5
End If

If btnExit.Left > Me.DisplayRectangle.Width - btnExit.Width Then
btnExit.Left = Me.DisplayRectangle.Width - btnExit.Width
End If

If e.X - btnExit.Left - btnExit.Width < 10 And e.X - btnExit.Left - btnExit.Width > 0 And e.Y - btnExit.Top < btnExit.Height Then
btnExit.Left -= 5
End If

If btnExit.Left < btnExit.Width Then
btnExit.Left = btnExit.Width
End If

If btnExit.Top - e.Y < 10 And btnExit.Top - e.Y > 0 And e.X - btnExit.Left < btnExit.Width Then
btnExit.Top += 5
End If

If btnExit.Top > Me.DisplayRectangle.Height - btnExit.Height Then
btnExit.Top = Me.DisplayRectangle.Height - btnExit.Height
End If

If e.Y - btnExit.Top - btnExit.Height < 10 And e.Y - btnExit.Top - btnExit.Height > 0 And e.X - btnExit.Left < btnExit.Width Then
btnExit.Top -= 5
End If

If btnExit.Top < btnExit.Height Then
btnExit.Top = btnExit.Height
End If
End Sub

Private Sub btnExit_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExit.MouseEnter, btnExit.MouseMove
btnExit.Left += btnExit.Width * (Math.Round(Rnd() * 2) - 1)
btnExit.Top += btnExit.Width * (Math.Round(Rnd() * 2) - 1)
End Sub
End Class