Ver Mensaje Individual
  #5 (permalink)  
Antiguo 16/09/2009, 16:41
Avatar de pkj
pkj
 
Fecha de Ingreso: julio-2006
Ubicación: Órbita sincrónica
Mensajes: 899
Antigüedad: 18 años, 9 meses
Puntos: 29
Respuesta: Animación gif en una aplicación

Ahí vá la sub que faltaba...


Código :
Ver original
  1. Private Sub Timer1_Timer()
  2.  
  3. On Error GoTo Timer1_TimerError
  4.  
  5. 'increment,show, and set the next timers interval
  6. 'incremento de, mostrar y ajustar el temporizador de intervalos siguiente
  7. ImgCnt = ImgCnt + 1
  8. Image1(ImgCnt).Visible = True
  9. Timer1.Interval = CInt(Image1(ImgCnt).Tag)
  10.  
  11. 'for gifs that have a moving animation each frame is offset from the first frame by some amount so you need to make sure that the old frame is not
  12. 'Gifs para que tengan una animación en movimiento cada cuadro se desplaza desde el primer fotograma de una cierta cantidad por lo que necesita para asegurarse de que el marco de edad no es
  13. 'shown because you would get one image overlaid on another (or in some cases next to each other).
  14. 'que se muestra porque se van a obtener una imagen superpuesta sobre otra (o en algunos casos junto a la otra).
  15. If ImgCnt = 0 Then
  16.  
  17.   'for images with offsets you need to do this
  18.   'para las imágenes con las compensaciones que tiene que hacer este
  19.   Image1(MaxCnt).Visible = False
  20.  
  21. Else
  22.  
  23.   'for images with offsets you need to do this
  24.   'para las imágenes con las compensaciones que tiene que hacer este
  25.   Image1(ImgCnt - 1).Visible = False
  26.  
  27.   'check to see if we have reached the end of the animation
  28.   'comprobar si hemos llegado al final de la animación
  29.   If ImgCnt = MaxCnt Then
  30.  
  31.     'reset the counter to before the first element since the first thing we do when we enter this sub is to increment the element counter
  32.     'restablecer el contador a antes del primer elemento ya que lo primero que hacemos cuando entramos en este subprograma es incrementar el contador de elemento
  33.     ImgCnt = -1
  34.    
  35.     'this can be removed for continious play but since it was decoded above...
  36.     'Esto se puede quitar para jugar, pero continuas desde que fue descifrado por encima de ...
  37.     If NumberOfTimesToRepeatSequence = 0 Then
  38.    
  39.       DoEvents
  40.  
  41.     Else
  42.  
  43.       'increment the number of times this animation has played and then check to see if we have reached the limit and if we have then disable the timer
  44.       'incrementar el número de veces que ha jugado esta animación y luego comprobar si hemos llegado al límite y si tenemos, entonces, desactivar el temporizador de
  45.       RepeatedCount = RepeatedCount + 1
  46.       If RepeatedCount > NumberOfTimesToRepeatSequence Then Timer1.Enabled = False
  47.    
  48.     End If
  49.  
  50.   End If
  51. End If
  52. Exit Sub
  53.  
  54. Timer1_TimerError:
  55. MsgBox Err.Description
  56.  
  57. End Sub

Saludos by PKJ

Última edición por pkj; 14/10/2009 a las 13:55