COLOREAR CÓDIGO HTML
Este código fué brindado por Jorge Rodigrez, en este caso nos brinda un simple ejemplo de como colerear código fuente Html, para lo cual se utilizaremos un formulario con nombre frmEditorHTML en el cual se insertera un texto rtf, para lo cual nos vamos al menú Proyecto -> Componentes -> Microsoft Rich TextBox Control 6.0 al cual se le colocará el nombre de rtbEditor y también se insertará un modulo con el nombre de modEditorHTML. Bueno basta de bla bla bla y vamos a ver el código que se agregará:
|
Form1
frmEditorHTML.frm
Private Sub Form_Load() oInfoEditor.EtiquetaActual = "" End Sub
Private Sub rtbEditor_KeyPress(KeyAscii As Integer) Dim Caracter As String Caracter = Chr(KeyAscii) If Caracter <> " " And KeyAscii <> 13 Then If Len(oInfoEditor.EtiquetaActual) = 0 Then oInfoEditor.PosicionInicial = Me.rtbEditor.SelStart End If oInfoEditor.EtiquetaActual = oInfoEditor.EtiquetaActual & Caracter Else If InStr(1, Etiquetas, oInfoEditor.EtiquetaActual, vbTextCompare) > 0 Then Dim PosActual As Integer PosActual = Me.rtbEditor.SelStart Me.rtbEditor.SelStart = oInfoEditor.PosicionInicial Me.rtbEditor.SelLength = Len(oInfoEditor.EtiquetaActual) Me.rtbEditor.SelColor = RGB(0, 0, 255) Me.rtbEditor.SelStart = PosActual Me.rtbEditor.SelLength = 0 Me.rtbEditor.SelColor = RGB(0, 0, 0) End If oInfoEditor.EtiquetaActual = "" End If End Sub
Modulo 1
modEditorHTML
Public Const Etiquetas As String = "<html>|</html>|<head>|</head>|<title>|</title>|<p>|</p>|<br>|<hr>"
Public Type InfoEditor EtiquetaActual As String PosicionInicial As Integer End Type
Public oInfoEditor As InfoEditor
Fin bueno debemos agradecer a Jorge por brindarnos este mágnifico ejemplo, si alguno de ustedes puede hacer que este ejemplo se convierta en un editor de código mas avanzado no deje de escribir a soporte@yalpublicidad.com , el código esta abierto para su mejora. Puedes bajar el codigo fuente
http://www.yalpublicidad.com/tutoriales |