How do you force a call to ILineTransformSource.GetLineTransform in a VS extension for a change to a line adornments dimensions?
Asked Answered
U

1

6

I 'm writing a Visual Studio extension where I'm creating line adornments that need to be resized when the user resizes the code view. I.e. when the user resizes Visual Studio's window width, I modify both the adornment's width and height. I'm handling the IWpfTextView.LayoutChanged event and I am resizing my adornments there. To avoid overlapping the adornments with the lines below it, I also implemented ILineTransformSource.GetLineTransform to enlarge the line's height to accommodate the size of the adornment.

However, when I change the dimensions of the adornments (when handling the IWpfTextView.LayoutChanged event) I'm not getting calls to my ILineTransformSource.GetLineTransform function to resize the line transform. This leaves the adornment overlapping the lines below it. I can't seem to find any way of forcing a call to ILineTransformSource.GetLineTransform. (Although, if the user scrolls the view, I do get these calls. But, I don't want to have to force the user to scroll the window to fix a visual glitch.)

Does anyone know of a way to force Visual Studio to call my ILineTransformSource.GetLineTransform so that I can resize the line transforms when my adornments change height?

Uther answered 30/12, 2011 at 21:36 Comment(1)
Did you figure this out? I need to make room for my adornment as well.Imbecile
E
2

Try calling the IWpfTextView.DisplayTextLineContainingBufferPosition method - this will force GetLineTransform calls as well.

Estimable answered 7/2, 2012 at 16:20 Comment(1)
Can you give me an idea of how I would put a class in place to capture these events when called? I am new to MEF so I have little understanding of what needs to be done here?Imbecile

© 2022 - 2024 — McMap. All rights reserved.