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

StackOverflow https://stackoverflow.com/questions/9179813

  •  26-04-2021
  •  | 
  •  

Domanda

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?

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top