开发者

How to change color and weight of text in VS2010 Text Adornment Extension?

In my TextAdornment1 class, I have the following defined:

  ' <summary>'
  ' On layout change add the adornment to any reformatted lines'
  ' </summary>'
  Private Sub OnLayoutChanged(ByVal sender As Object, ByVal e As TextViewLayoutChangedEventArgs) Handles _view.LayoutChanged
    For Each line In e.NewOrReformattedLines
      Me.Creat开发者_运维百科eVisuals(line)
    Next line
  End Sub

An instance of ITextViewLine gets passed to my CreateVisuals method. How do I change the color of the text on that particular line, and how do I make it bold? I see plenty of examples of drawing images to highlight text, but nothing so far that changes the formatting of the actual text. How can I do this?


I don't think this can be done via the adornments (AFAIK, they only add elements to the window, not alter existing ones).

I recommend you look into the "Editor Classifiers" which will allow you to alter the formatting of text (the VS SDK includes a good project template for classifiers).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜