How to draw a horizontal dividing line in the Editor, just like the Vb editor in VS.

SyntaxEditor for WPF Forum

Posted 2 months ago by Sunshine - Appeon
Version: 21.1.2
Avatar

I want to draw a horizontal dividing line on the Editor to divide the code of two different blocks. 

How to achieve this effect? Thanks!

Comments (1)

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

Hello,

You'd want to use our adornment API for that kind of thing.  I might suggest starting with a QuickStart like the AdornmentsAlternatingRows one.  That sample is rendering backgrounds on every other line.

Your scenario is different but does need to do some similar things.  Instead of making adornments for odd-indexed lines, you would need a way to use the text ranges for added/updated view lines and see if they are the end of a code block.  You'd have to use the text range and compare that with AST or other parse data you have telling you such things.  Then add the adornment if it's a block end.

Your OnDrawAdornment logic would simply draw a 1px high rectangle at the bottom of the view line's bounds.


Actipro Software Support

The latest build of this product (v21.1.3) was released 16 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.