如何在 Scintilla 中自动滚动?

发布于 2024-09-03 10:26:24 字数 88 浏览 7 评论 0原文

我有一个使用 Scintilla 的简单 VB.NET 应用程序。我不知道如何使控件在添加文本时自动滚动。

有人可以帮忙吗?

谢谢

I have a simple VB.NET application using Scintilla. I don`t know how can I make the control auto scroll when text is added to it.

Can anyone help?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

撕心裂肺的伤痛 2024-09-10 10:26:24

完毕。

Scintilla 可以通过调用自动滚动:


Scintilla1.Scrolling.ScrollBy(0, Scintilla1.Lines.Count)

因此它滚动到最后一个文本行。

Done.

Scintilla can auto-scroll by calling:


Scintilla1.Scrolling.ScrollBy(0, Scintilla1.Lines.Count)

so it scrolls to the last text line.

梦里人 2024-09-10 10:26:24

当尝试使 ScintillaNET 编辑器控件在更新 Text 属性后滚动到底行时,接受的解决方案对我不起作用。也许是因为我将它嵌入到 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);

The accepted solution didn't work for me when trying to make a ScintillaNET editor control scroll to the bottom line after updating the Text property. Perhaps it's because I am embedding it in a WPF WindowsFormsHost. In any event, here is the code I used to make the ScintillaNET editor control auto-scroll in my context. (Note, the code is in 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);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文