SyntaxEditor view height and scroll bar height get

SyntaxEditor for WPF Forum

Posted 3 years ago by Sunshine - Appeon
Version: 21.1.1
Avatar

As the picture show: https://ibb.co/JjY0NBk.

I need get the view heigth and vertical scroll bar hegith.

Used to realize the position of diagnostic on the overall margin,just like the far right of the picture.

I want to know how to get the two heights of the picture:

1.Editor view height.

2.Vertical scroll hegith.

Comments (1)

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

Hello,

The editor.ActiveView.TextAreaViewportBounds property returns the bounds of the editable text area, meaning where the text actually is, excluding margins and scrollbars.  The bounds are relative to the editor view itself. 

To get those bounds relative to SyntaxEditor (if you allow split views, since in that case the view won't be the same bounds as SyntaxEditor), you'd have to translate it up like:

editor.ActiveView.VisualElement.TransformToAncestor(editor).TransformBounds(editor.ActiveView.TextAreaViewportBounds)

In your screenshow, I believe #1 is the text area viewport bounds height.

#2 would be the #1, subtracting the two scrollbar button heights and the splitter height (if there is no split).  The buttons should be  a height of SystemParameters.VerticalScrollBarButtonHeight.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.