![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
IHello I would like to change the font size, color, name, when I click on a word and reurn it back to its previous style if i click it again. I try this but it works only if I make a double click on the word... When i want to select a piece of word without an apostrophe for example it crashes: What's wrong? Private Sub RTB_txt_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RTB_txt.SelectionChanged If RTB_txt.SelectionFont.Name = ("Tahoma") And _ RTB_txt.SelectionFont.Size = "12" And _ RTB_txt.SelectionFont.Style = FontStyle.Bold And _ RTB_txt.SelectionColor = System.Drawing.Color.Red Then RTB_txt.SelectionFont = New Font("Arial", 11, FontStyle.Regular) RTB_txt.SelectionColor = System.Drawing.Color.Black Else RTB_txt.SelectionFont = New Font("Tahoma", 12, FontStyle.Bold) RTB_txt.SelectionColor = System.Drawing.Color.Red RTB_txt.AutoWordSelection = True End If End Sub thanks pascal |
#3
| |||
| |||
|
|
"Pascal" <scalpaSansSpam (AT) scalpa (DOT) info> wrote in message news:3961F5EE-8ADE-45D7-91F9-2503C36B8084 (AT) microsoft (DOT) com... IHello I would like to change the font size, color, name, when I click on a word and reurn it back to its previous style if i click it again. I try this but it works only if I make a double click on the word... When i want to select a piece of word without an apostrophe for example it crashes: What's wrong? Private Sub RTB_txt_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RTB_txt.SelectionChanged If RTB_txt.SelectionFont.Name = ("Tahoma") And _ RTB_txt.SelectionFont.Size = "12" And _ RTB_txt.SelectionFont.Style = FontStyle.Bold And _ RTB_txt.SelectionColor = System.Drawing.Color.Red Then RTB_txt.SelectionFont = New Font("Arial", 11, FontStyle.Regular) RTB_txt.SelectionColor = System.Drawing.Color.Black Else RTB_txt.SelectionFont = New Font("Tahoma", 12, FontStyle.Bold) RTB_txt.SelectionColor = System.Drawing.Color.Red RTB_txt.AutoWordSelection = True End If End Sub thanks pascal I'm not sure, but I think you're asking for trouble by changing selection related properties in the SelectionChanged event handler. Have you tried putting this code in a Click event handler instead? -- Jack |
#4
| |||
| |||
|
|
Hello I tried this but nothing happens: Private Sub RTB_txt_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RTB_txt.Click If RTB_txt.SelectionFont.Name = ("Tahoma") And _ RTB_txt.SelectionFont.Size = "12" And _ RTB_txt.SelectionFont.Style = FontStyle.Bold And _ RTB_txt.SelectionColor = System.Drawing.Color.Red Then RTB_txt.SelectionFont = New Font("Arial", 11, FontStyle.Regular) RTB_txt.SelectionColor = System.Drawing.Color.Black Else RTB_txt.SelectionFont = New Font("Tahoma", 12, FontStyle.Bold) RTB_txt.SelectionColor = System.Drawing.Color.Red RTB_txt.AutoWordSelection = True End If End Sub |
#5
| |||
| |||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |