Bonjour
Pourquoi ceci ne marche pas ?
Var tStRun as integer=TextArea1.StyledText.StyleRunCount()
Dim j as integer
For j = 0 to tStRun-1
if TextArea1.StyledText.StyleRun(j).Underline = True then
Dim t As string = TextArea1.StyledText.StyleRun(j).Text
var c as string
For each c in t.characters
Dim newText As string
newText = t.ReplaceAll(c, “-”)
TextArea1.StyledText.StyleRun(j).Text= newText
next
end if
next
Je veux préparer un exercice à trous dans un styledtext et remplacer les styleruns en pointillés.
Merci !!!
Tu veux remplacer les caractères soulignés par des ‘-’ ?
It would help if you indicated what you want this to do, and what it actually does. “Ne marche pas” is too vague.
Oui, c’est exactement ça.
Merci de ton écoute.
Nothing occurs in the textarea. None character replaced in the stylerun text.
Thanks
Tu peux faire comme ceci :
Var tStRun as integer=TextArea1.Text.CharacterCount
For j As Integer = 0 to tStRun-1
if TextArea1.StyledText.Underline(j) = True then
TextArea1.SelectionStart = j
TextArea1.SelectionLength = 1
TextArea1.SelectedText = "-"
end if
next
1 Like
Effectivement, ça fonctionne parfaitement. Et c’est plus efficace que d’intervenir sur le stylerun.
Merci infiniment Valdemar
2 Likes