我有一个使用 Scintilla 的简单 VB.NET 应用程序。我不知道如何使控件在添加文本时自动滚动。
任何人都可以帮忙吗?
谢谢
完毕。
Scintilla 可以通过调用自动滚动:
Scintilla1.Scrolling.ScrollBy(0, Scintilla1.Lines.Count)
所以它滚动到最后一个文本行。
在更新 Text 属性后尝试使 ScintillaNET 编辑器控件滚动到底线时,接受的解决方案对我不起作用。也许是因为我将它嵌入到 WPF WindowsFormsHost 中。无论如何,这是我用来使 ScintillaNET 编辑器控件在我的上下文中自动滚动的代码。(注意,代码在 C# 中):
// Declaration for the WinAPI SendMessage() method.
[DllImport("user32.dll")]
public static extern IntPtr SendMessage(IntPtr hWnd, uint wMsg, UIntPtr wParam, IntPtr lParam);
/// WM_VSCROLL -> 0x0115
public const int WM_VSCROLL = 277;
/// SB_BOTTOM -> 7
public const int SB_BOTTOM = 7;
// scintillaCtl should be a reference to the Scintilla control you want to scroll vertically.
SendMessage(scintillaCtl.Handle, WM_VSCROLL, new UIntPtr(SB_BOTTOM), IntPtr.Zero);