Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

In my form I have a RichTextBox. I also have a VScrollBar and HScrollBar. I set the RichTextBox property ScrollBars to None so I can use the new scroll bars for it. Thats where I hit a problem, how do I do it? I searched online and found nothing for "c# richtextbox vscrollbar"

Please add references to articles to your answers so I can learn how it works.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
667 views
Welcome To Ask or Share your Answers For Others

1 Answer

I don't know if there is a way to do what you want. The best thing I can thing of would be to try and find the right position in the text, then Select() and ScrollToCaret(). I usually only use that trick to force a TextBox/RichTextBox to scroll to the very end, though. It wouldn't be very easy to use it for what you want.

Is there a reason why you don't want to use the default scroll bars?

In my experience, I've rarely had any luck anytime I've tried to use custom scroll bars in C# - especially with a control that has the ability to auto-scroll built it.

The only time I've used them without too much trouble is with a third party control that didn't have an auto-scroll capability.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...