0

我正在尝试使用在程序执行期间收集的各种指标来装饰代码行。为了做到这一点,我使用了 VS 可扩展性和装饰层。然而,当编辑器滚动时,它似乎有点不稳定并且相对于文档的顶部移动,从而破坏了代码和装饰的对齐方式。此外,它并不总是在编辑器的顶部初始化。

那么在Visual Studio 2010中如何锚定添加到代码编辑器中的装饰层呢?我通过以下方式将画布添加到其中:

     _adornmentLayer = view.GetAdornmentLayer("CodeAdornment");
     _adornmentLayer.RemoveAllAdornments();
     Canvas.SetTop(myOwnCanvas, 0);
     adornmentLayer.AddAdornment(AdornmentPositioningBehavior.OwnerControlled, null, null, myOwnCanvas, null);

我开始觉得这是编辑器布局中的错误。

4

1 回答 1

0

You might want to make a viewport adornment that will always be on the top of the editor. Otherwise, you might want to use AdornmentPositioningBehavior.TextRelative and give a span for the first line in the document.

于 2012-12-18T03:44:31.930 回答