document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. \' Gambas class file
  2.  
  3. Private avance As Integer = 10
  4.  
  5. Public Sub _new()
  6.  
  7. End
  8.  
  9. Public Sub Form_Open()
  10.  
  11.   ComboBoxOperador.Add("suma")
  12.   ComboBoxOperador.Add("resta")
  13.   ComboBoxOperador.Add("multiplica")
  14.   ComboBoxOperador.Add("divide")
  15.  
  16.   \'Recalculo en 1 segundo:
  17.   TimerCalcular.Delay = 1000 \'1 segundo
  18.   TimerCalcular.Start()
  19.  
  20.   \'dibujo animado
  21.   TimerAnimacion.delay = 500 \'0.5 segundos
  22.   TimerAnimacion.Start()
  23.  
  24. End
  25.  
  26. Public Sub TimerCalcular_Timer()
  27.  
  28.   Select Case ComboBoxOperador.Text
  29.     Case "suma"
  30.       ValueBoxResultado.value = ValueBox1.value + ValueBox2.Value
  31.       LabelMensaje.text = "He sumado"
  32.     Case "resta"
  33.       ValueBoxResultado.value = ValueBox1.value - ValueBox2.Value
  34.       LabelMensaje.text = "He restado"
  35.     Case "multiplica"
  36.       ValueBoxResultado.value = ValueBox1.value * ValueBox2.Value
  37.       LabelMensaje.text = "He multiplicado"
  38.     Case "divide"
  39.       If ValueBox2.value <> 0 Then
  40.         ValueBoxResultado.value = ValueBox1.value / ValueBox2.Value
  41.         LabelMensaje.text = "He dividido"
  42.       Else
  43.         LabelMensaje.text = "No puedo dividir entre cero"
  44.       Endif
  45.   End Select
  46.  
  47. End
  48.  
  49. Public Sub TimerAnimacion_Timer()
  50.   \'calculando si rebota o no al llegar a los bordes:
  51.  
  52.   If (PictureBox1.x + PictureBox1.w) > Me.w Then
  53.     avance = -10
  54.   Else
  55.     If PictureBox1.x < 0 Then
  56.       avance = +10
  57.     Endif
  58.   Endif
  59.   PictureBox1.x += avance
  60.  
  61. End
');