Ver Mensaje Individual
  #3 (permalink)  
Antiguo 16/02/2010, 17:08
Avatar de erbuson
erbuson
 
Fecha de Ingreso: noviembre-2009
Mensajes: 701
Antigüedad: 14 años, 5 meses
Puntos: 53
Respuesta: Crear un highlight en VB 6.0

Una posibilidad mas y diferente.

Código vb:
Ver original
  1. Private Sub RichTextBox1_KeyPress(KeyAscii As Integer)
  2.   Static ColorNegro As Boolean
  3.   If ColorNegro Then
  4.     ' Si recibió un caracter de Cierre, activa antes color Negro
  5.    RichTextBox1.SelColor = vbBlack
  6.     ColorNegro = False
  7.   End If
  8.   Select Case Chr$(KeyAscii)
  9.     Case Is = "[": RichTextBox1.SelColor = vbBlue
  10.     Case Is = "(": RichTextBox1.SelColor = vbRed
  11.     Case Is = "{": RichTextBox1.SelColor = vbGreen
  12.     Case Is = "<": RichTextBox1.SelColor = vbMagenta
  13.     Case Is = "¿": RichTextBox1.SelColor = vbCyan
  14.     Case Is = "]", ")", "}", ">", "?"
  15.       ColorNegro = True
  16.       ' Cambiará color justo antes de la próxima pulsacion
  17.  End Select
  18. End Sub

Solo necesitas un RichTextBox para probarlo