Show LineNumbers from the RichTextBox in WPF

前端 未结 5 1508
再見小時候
再見小時候 2020-12-28 23:00

I found an example, how to show the LineNumbers from a RichTextBox in Windows Forms. http://www.codeproject.com/Articles/38858/Line-Numbers-for-RichText-Control

5条回答
  •  余生分开走
    2020-12-28 23:20

    I thought just to add a simple solution...

    Avalon (Download) has been mentioned, here is how to do row lines with it:

    
      
    

    It's a very powerful editor - and I've been doing a lot with it and in production (custom language compilers etc.). It's free so it has its 'quirks' but it's allowing you to do pretty much anything you need. I'm not sure which formatted text are you talking about - but anything you need can be done, and in not too many lines of code, if you know how, where to inject (you can add your own generators, transformers, pretty much any visuals, code completition etc. - and I have no vested interest in it:)

    Edit

    Small sample for syntax highlighting:

      
    

    Supported is "XmlDoc", "C#", "JavaScript", "HTML", "ASP/XHTML", "Boo", "Coco", "CSS", "C+", "Java", "Patch", "PHP", "TeX", "VBNET", "XML" as far as I can tell from the code.

    If you'd like to implement your own custom syntax highlighting (Avalon editor is highly extendable - for details see that code project article mentioned)...

    You'd need to define your own IHighlightingDefinition, then register that with the HighlightingManager from the code - and then add some more things to complement. But that's a long story on its own.

提交回复
热议问题