在Scintilla.NET组件中获取可见线 [英] Get visible lines in Scintilla.NET component

查看:92
本文介绍了在Scintilla.NET组件中获取可见线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取C#中Scintilla组件的第一个可见(顶部)和最后一个可见(底部)行号?例如,如果我滚动文本并且能够看到第5-41行(不折叠,这是该组件当前显示的行数;其余的则必须滚动至它们),如何我可以通过编程方式获得这些数字吗?

How can I get the first visible (top) and last visible (bottom) lines number for Scintilla component in C#? For example, if I scroll the text and I am able to see lines 5-41 (no folding, it is the number of lines which are shown by the component at the moment; the rest, you have to scroll to them), how do I get those numbers programatically?

推荐答案

如果您想了解如何使用Scintilla进行操作,那么您的第一站应该始终是核心

If you ever want to find out how to do something with Scintilla, your first stop should always be the core Scintilla Documentation. It is comprehensive, and usually kept fully up to date.

正确的方法是使用 SCI_GETFIRSTVISIBLELINE 消息来获取第一行,然后使用 SCI_LINESONSCREEN 消息来计算最后一行.

The correct way to do what you want is to use the SCI_GETFIRSTVISIBLELINE message to get the first line, and then use the SCI_LINESONSCREEN message to calculate the last line.

可能有针对这些消息的Scintilla.NET包装器方法.但是 Scintilla.NET文档看起来很差,并且没有.不能提供其API的完整说明-尽管我想您总是可以使用SendMessageDirect方法(记录了 )直接发送消息(如果您无法猜出包装方法是什么)

There are probably Scintilla.NET wrapper methods for those messages. But the Scintilla.NET documentation seems very poor, and doesn't provide a complete description of its API - although I suppose you could always use the SendMessageDirect method (which is documented) to send the messages directly if you can't guess what the wrapper method is called.

这篇关于在Scintilla.NET组件中获取可见线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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