Calculate max visible lines

SyntaxEditor for WPF Forum

Posted 6 years ago by Mike
Version: 17.2.0665
Avatar

Hi,

how can I programatically get the maximum visible lines the document CAN display? Respecting zoom level, DPI, font, etc. I guess I would need something like line display height property dividing with the editors height. But there is no such property as far as I know.

Comments (1)

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

The editor.ActiveView.VisibleViewLines.FullyVisibleCount property should tell you how many lines are fully visible.  However another partial line depending on height could be visible too.  Each of those view lines in VisibleViewLines has a Bounds property, from which you can get height.  As long as you have a single font in use and don't use intra-line spacers, then each view line should have the same height.  The editor.ActiveView.TextAreaViewportBounds property gives the bounds of the text area, which excludes margins.


Actipro Software Support

The latest build of this product (v24.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.