How to get the location of IAdornment when zoomed or scrolled

SyntaxEditor for WPF Forum

Posted 6 years ago by Daisuke Nakada
Version: 17.2.0664


Please tell me how to get the correct location of an IAdornment when the editor is zoomed-in or zoomed-out.

I want to determin whether an IAdornment is displayed or not taking scrolling and zooming into consideration.


I put an intra text adornment next to each variables on the editor and an adornment shows the current value of the variable.

I need to determine whether an adornment is displayed or not because I do not want meaningless communication occurs for scrolled-out variables.


Comments (1)

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


All adornments should be relative to the text area part of the editor view.  And as such, any zooming should already be factored into their IAdornment.Location when doing intra-text adornments.  

You can use the view.TransformFromTextArea method to transform a Rect (like the adornment bounds) from text area-relative coordinates to view-relative coordinates.  Then the view.TextAreaViewportBounds property returns the viewport area of the text area in view-relative coordinates.  Using that information, combined with view.FirstVisibleX (the horizontal scroll amount), you should be able to determine if an adornment is in the viewport.

Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.