ITextViewLine.GetTextBounds returns wrong value when zoomed

SyntaxEditor for WPF Forum

Posted 2 years ago by Xinen Lee
Version: 16.1.0635
Platform: .NET 4.5
Environment: Windows 7 (64-bit)
Avatar

Hi Actipro,

When using ITextViewLine.GetTextBounds() to retrieve a line's rectangle while text is zoomed in or with different screen resolution, my text bound width/height is the same as that while the text is not zoomed in. Shouldn't the width/height be bigger when the text is zoomed in?

This seriously affects our automation tests, and any other calculations that depend on GetTextBounds to retrieve a line's height/width. Please advise.

 

Thanks

Xinen

Comments (2)

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

Hi Xinen,

I believe the ITextViewLine.GetTextBounds() method returns bounds relative to the text area within the view.  You would then need to call view.TransformFromTextArea to convert those bounds to IEditorView oriented bounds.  The view itself should outside of the "zoomed" bounds, which are only the scrollable area.  From there if you needed to transform to an ancestor element like SyntaxEditor, you could transform from the view's VisualElement property.


Actipro Software Support

Posted 2 years ago by Xinen Lee
Avatar

Ok got it. Thanks Actipro!

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.