如何将滚动条向上移动一行? (在C#RichTextBox中) [英] How to move scroll bar up by one line? (In C# RichTextBox)
本文介绍了如何将滚动条向上移动一行? (在C#RichTextBox中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
对于我的C#RichTextBox,我要以编程方式执行与单击垂直滚动条顶部的向上箭头相同的操作,这会将RichTextBox显示上移一行.这是什么代码?谢谢!
For my C# RichTextBox, I want to programmatically do the same thing as clicking the up arrow at the top of a vertical scroll bar, which moves the RichTextBox display up by one line. What is the code for this? Thanks!
推荐答案
这就是我要做的事情:
using System.Runtime.InteropServices;
[DllImport("user32.dll")]
static extern int SendMessage(IntPtr hWnd, uint wMsg,
UIntPtr wParam, IntPtr lParam);
然后致电:
SendMessage(myRichTextBox.Handle, (uint)0x00B6, (UIntPtr)0, (IntPtr)(-1));
似乎可以正常工作-不过,您可能需要进行一些调整.
Seems to work OK - you might need to tweak things a bit, though.
希望有帮助.
这篇关于如何将滚动条向上移动一行? (在C#RichTextBox中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文