Controlling RichTextBox scroll position in C#?

Controlling RichTextBox scroll position in C#?

Post by Charles Ra » Sat, 30 Aug 2003 14:27:31


I'm trying to write a little chat client, and I need to be able to force
my output textbox to autoscroll down to the bottom of the text. I'm
using a RichTextBox as an output area, and I can't for the life of me
find a way to force it to keep locked to the latest text that's been
added to the control. The only way I've found that might come close
involves using ScrollToCaret(), but this is an annoying workaround,
since I'd have to set the focus to the box, call the function, then
reset the focus to whichever control was in focus during the operation.

Does anyone know a better way to do this? Someone suggested that I use
a listbox instead, but I want to be able to use the benefits that the
RichTextBox offers (links, colored text, etc).

Any help is much appreciated.

Charles.
 
 
 

1. Editing hyperlinks in RichTextBox Control in C#.NET

2. changing scroll rate on a scrolled window changes scroll position

I wanted to know if this is a bug or a feature:

I have a wxScrolledWindow. I set the scroll rate to say 10. I then scroll the
window down say 20 steps which means its scrolled 20*scrollunits = 200. If I
now change the scroll units on the fly to say 1, instead of updating its
position internally, on the next scroll event, the scroll jumps to its location
according to the new units which would be 20*scrollunits = 20 instead updating
the scroll position to what would now be 200 under the new setting.

I realize that there is the issue that the scroll position may not be a whole
number (if going in the other direction), but there still should be a better
solution.

---------------------------------------------------------------------
To unsubscribe, e-mail: XXXX@XXXXX.COM
For additional commands, e-mail: XXXX@XXXXX.COM

3. Editing hyperlinks in RichTextBox Control in C#.NET

4. Can I get native code add-ins when I development the add-ins using C#?

5. WIN XP SP2 active X controls, plug ins, add ins, downloading s

6. XP SP2 active x control,add-ins,plug-ins nightmare

7. How to set position of a web control depending on other control's position at run-time?

8. WIN XP SP2 active X controls, plug ins, add ins, downloading software

9. scrolling all the controls inside Panel while holding and scrolling panel's scroll bar at same time.

10. Is it possible to set the scroll position of a datagridview control?

11. Scroll to byte position on a String Control

12. how to set position of scroll bar control thumb

13. HowTo: Synchronise Scroll Position of Two ListView Controls

14. Access 2000 controlling scrolling window position

15. statusbar INS and richtextbox problem