Ver Mensaje Individual
  #11 (permalink)  
Antiguo 12/12/2009, 09:20
Avatar de pkj
pkj
 
Fecha de Ingreso: julio-2006
Ubicación: Órbita sincrónica
Mensajes: 899
Antigüedad: 17 años, 9 meses
Puntos: 29
Respuesta: Un Reto: Mensaje de texto rotativo

Ya he creado una versión de la sub CambiaColores bastante más rápida. A ver si no aparecen bugs.

Código vb:
Ver original
  1. Sub CambiaColores(RTB As RichTextBox)
  2.   Dim Pos As Long
  3.   Dim PosAbre As Long
  4.   Dim PosCierra As Long
  5.   Dim Contador As Long
  6.   With RTB
  7.     Do
  8.       PosAbre = InStr(Pos + 1, RTB.Text, "{")
  9.       PosCierra = InStr(Pos + 1, RTB.Text, "}")
  10.       If PosAbre > 0 And (PosAbre < PosCierra Or PosCierra = 0) Then
  11.         .SelStart = Pos
  12.         .SelLength = PosAbre - Pos - 1
  13.         .SelColor = Colores(Contador)
  14.         If Contador < 5 Then Contador = Contador + 1
  15.         .SelStart = PosAbre - 1
  16.         .SelLength = 1
  17.         .SelColor = Colores(Contador)
  18.         Pos = PosAbre
  19.       ElseIf PosCierra > 0 Then
  20.         .SelStart = Pos
  21.         .SelLength = PosCierra - Pos
  22.         .SelColor = Colores(Contador)
  23.         If Contador > 0 Then Contador = Contador - 1
  24.         Pos = PosCierra
  25.       Else
  26.         .SelStart = Pos
  27.         .SelLength = Len(RTB.Text)
  28.         .SelColor = Colores(Contador)
  29.         Exit Do
  30.       End If
  31.     Loop
  32.   End With
  33. End Sub

A ver si alguien publica un "aleatori-libro" de aventuras

Saludos
__________________
No hay preguntas tontas, solo gente estup..., ¡No!, ¿como era? No hay gente que pregunte a tontos... ¡Nooo!... ¡Vaya cabeza!

Última edición por pkj; 12/12/2009 a las 09:35