Rich Textbox and SelColor 
Author Message
 Rich Textbox and SelColor

Works here... even though I assumed you'd need to select at least one character, I gave it a try anyway and the color is tracked correctly.
Option Explicit

Private Sub Form_Load()
   With RichTextBox1
      'Clear all
      .Text = ""
      .SelColor = vbRed
      .SelText = "This is red text"
      .SelBold = True
      .SelColor = vbBlue
      .SelText = "This is blue and bold"
      .SelFontSize = 14
      .SelColor = vbGreen
      .SelText = "This is bold, green and 14 points high"
   End With
End Sub

Private Sub RichTextBox1_SelChange()
   Debug.Print RichTextBox1.SelColor
End Sub

  When you left click the mouse on a rich text box,
  the rtf_selChange event will fire (amongst other
  events). All of the ".sel...." properties get populated
  from the character following the cursor, except for
  If you move around in the rich text box with the
  arrow keys, the ".selColor" does get updated

  Does anybody have a work around for this?


  I use the color to flag special meanings in the
  word processing that we have on our back
  office unix word processor. I use the colors
  for five flags. I would prefer to add the five
  flags as unique properties that are updated
  for each character in the text box (like bold,
  italics, etc. are used)

  Does anybody know how to do that?


Sun, 25 Jan 2004 22:12:45 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Rich Text and selcolor

2. Adding to Rich Text in Rich Textbox

3. Textbox as a rich-textbox?

4. Textbox as a rich-textbox?

5. Rich Textbox / Textbox Scrolling

6. .SelColor

7. Rich textbox URGENT!!!!

8. Help with textbox/rich scrolling to a position

9. Rich TextBox

10. Rich Textbox

11. Rich Textbox Bold Monospaced font

12. Write to rich textbox on the fly?


Powered by phpBB® Forum Software