Visual Basic.NET - richtextbox con linea de cada color

 
Vista:

richtextbox con linea de cada color

Publicado por sergio (7 intervenciones) el 26/03/2009 23:26:30
Quiero hacer un richtextbox con una linea de cada color. Tengo este código:

Public Class Form1
Dim UltimaPosicion As Integer = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

With RichTextBox1
.Text &= "AAAA" & vbNewLine
.SelectionStart = UltimaPosicion
.SelectionLength = .TextLength
.SelectionFont = New Font(.SelectionFont.FontFamily, .SelectionFont.Size, FontStyle.Regular)
.SelectionColor = Color.Red
'.SelectionStart = .SelectionStart + .SelectionLength
.Refresh()
UltimaPosicion = .SelectionStart + .SelectionLength
End With
End Sub

Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click

With RichTextBox1
.Text &= "BBBB" & vbNewLine
.SelectionStart = UltimaPosicion
.SelectionLength = .TextLength
.SelectionFont = New Font(.SelectionFont.FontFamily, .SelectionFont.Size, FontStyle.Regular)
.SelectionColor = Color.Blue
'.SelectionStart = .SelectionStart + .SelectionLength
.Refresh()
UltimaPosicion = .SelectionStart + .SelectionLength
End With
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
UltimaPosicion = 0
RichTextBox1.Text = String.Empty
End Sub
End Class

Pero al tercer intento no hace lo correcto... pone las tres lineas en el color que has empezado. Alguien sabe pq.?
Asias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:richtextbox con linea de cada color

Publicado por laura (1 intervención) el 12/12/2009 18:00:53
Eso es porque el cluster ha dinamizado y el condesador de fluzo ha dinamizazo, ponle color, sino busca informacion
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:richtextbox con linea de cada color

Publicado por scp (7 intervenciones) el 14/12/2009 18:18:35
El condesador de fluzo ha dinamizazo.... ??? Busque por google y nada
Como lo evito? o mejor dicho, como desdinamizo el cluster? :-D
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar