Necesito cambiar el estilo de un Richtextbox y no lo consigo. Lo realizo
mediante el siguietne codigo, que es lo que está mal o como deberia de
usarlo.
Gracias por la ayuda
FormateaTexto(RTxt_Previo, TextoEscribir, False, True) => Esta funcion la
uso para cambiar el texto que quiero
Private Sub FormateaTexto(ByVal Componente As RichTextBox, ByVal
TextoACambiar As String, Optional ByVal Negrita As Boolean = False, Optional
ByVal Subrayado As Boolean = False)
Componente.Find(TextoACambiar)
Dim currentFont As System.Drawing.Font = Componente.SelectionFont
Dim newFontStyle As System.Drawing.FontStyle
If Negrita Then
newFontStyle = FontStyle.Bold
Else
newFontStyle = FontStyle.Regular
End If
If Subrayado Then
newFontStyle = FontStyle.Underline
Else
newFontStyle = FontStyle.Regular
End If
Componente.SelectionFont = New Font(currentFont.FontFamily,
currentFont.Size, newFontStyle)
If Subrayado Then
newFontStyle = FontStyle.Underline
Else
newFontStyle = FontStyle.Regular
End If
Componente.SelectionFont = New Font(currentFont.FontFamily,
currentFont.Size, newFontStyle)
End Sub
Leer las respuestas