【问题标题】:How make autoscroll in Scintilla?如何在 Scintilla 中进行自动滚动?
【发布时间】:2010-05-24 17:03:56
【问题描述】:

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

谁能帮忙?

谢谢

【问题讨论】:

    标签: scroll scintilla


    【解决方案1】:

    完成。

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

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

    所以它会滚动到最后一行。

    【讨论】:

    • 您也可以使用不带参数的 SCI_SCROLLCARET,其作用与上述相同,并检查插入符号策略。
    • @RaptorX 使用 SCI_SCROLLCARET 选项调用什么函数?
    【解决方案2】:

    在更新 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);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-18
      • 1970-01-01
      • 2022-07-15
      • 1970-01-01
      相关资源
      最近更新 更多