如何与RichTextBox一起使用VScrollBar和HScrollBar? [英] How to use VScrollBar and HScrollBar together with a RichTextBox?

查看:228
本文介绍了如何与RichTextBox一起使用VScrollBar和HScrollBar?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的表格中,我有一个RichTextBox.我也有一个VScrollBarHScrollBar.我将RichTextBox属性ScrollBars设置为None,以便可以使用新的滚动条.那就是我遇到问题的地方,我该怎么办?我在网上搜索,却找不到"c#richtextbox vscrollbar"

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.

推荐答案

我不知道是否有一种方法可以做您想要的事情.我能做的最好的事情是尝试在文本中找到正确的位置,然后选择Select()和ScrollToCaret().不过,我通常只使用这种技巧来强制TextBox/RichTextBox滚动到最底端.将它用于您想要的东西并不是很容易.

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?

根据我的经验,我很少尝试在C#中使用自定义滚动条,尤其是具有能够自动滚动构建的控件的运气.

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.

这篇关于如何与RichTextBox一起使用VScrollBar和HScrollBar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆