• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
南南的空间
博客园    首页    新随笔    联系   管理    订阅  订阅
C# 代码自动高亮着色(二)

Samples(这个主要是例子的图片了)

Demo application has many samples. Below is a brief description:

  • Powerful sample. Contains many features: syntax highlighting, code folding, export, same words highlighting and other.
  • PowerfulCSharpEditor. Powerful multitab C# source files editor. Supports highlighting, multitab backward/forward navigation, dynamic methods list, autocomplete and other.

做的很好了,功能也很多c#编程的!

  • Simplest syntax highlighting sample. Shows how to make simplest syntax highlighting.
  • Marker sample. Shows how to make marker tool. Sample uses class ShortcutStyle for create clickable markers on text area:

Custom style sample. This example shows how to create own custom style. Next custom style draws frame around of the words:

用户自定义的样式

class EllipseStyle : Style
{
    public override void Draw(Graphics gr, Point position, Range range)
    {
        //get size of rectangle
        Size size = GetSizeOfRange(range);
        //create rectangle
        Rectangle rect = new Rectangle(position, size);
        //inflate it
        rect.Inflate(2, 2);
        //get rounded rectangle
        var path = GetRoundedRectangle(rect, 7);
        //draw rounded rectangle
        gr.DrawPath(Pens.Red, path);
    }
}

  • VisibleRangeChangedDelayed usage sample. This example shows how to highlight syntax for extremely large text by VisibleRangeChangedDelayed event.
  • Simplest code folding sample. This example shows how to make simplest code folding.
  • Custom code folding sample. This example shows how to make costom code folding (on example of Python).
  • Autocomplete sample, Autocomplete sample 2. Examples show how to create autocomplete functionality:

  • Tooltip sample. It shows tooltips for words under mouse.
  • Dynamic highlighting sample. Shows how to make dynamic syntax highlighting. This example finds the functions declared in the program and dynamically highlights all of their entry into the code of LISP.
  • Syntax highlighting by XML Description. This example uses XML file for description syntax highlighting.
  • IMEmode sample.This example supports IME entering mode and rendering of wide characters.

例子居然是道德经的,喔喔!

Image drawing sample. Sample shows how to draw images instead of text:

 

  • This example supports animated GIF too.

  • AutoIndent sample. Sample shows how to make custom autoindent functionality.
  • BookmarksSample. Sample shows how to make bookmarks functionality.
  • Logger sample. It shows how to add text with predefined style:

Split sample. It shows how to make split-screen mode:

  • Lazy loading sample. It shows how to work with files of extremally large size.
  • Console sample. It shows how to create console emulator.
  • HintSample. It shows how to use hints:

  • ReadOnlySample. The example shows how to create readonly blocks of the text.
  • MacrosSample. This sample shows how to use macros for hard formatting of the code.
  • PredefinedStylesSample. Here we create large readonly text with predefined styles, hyperlinks and tooltips.
  • Joke sample. It contains some additional features, implemented custom TextStyle:

Performance

For storing one megabyte of text requires approximately 6 MB of RAM (include undo/redo stack objects). The coloring does not consume significant resources.

The use of regular expressions and saving memory usage, allow to reach high performance component. I tested the file of 50,000 lines (about 1.6 MB) of C# code. The total time of insertion, and the syntax coloring was about 3 seconds. Further work with the text passed without significant delays.

Restrictions

The component does not support center or right alignment and uses only monospaced fonts. Also tabs are always replaced by spaces.

History

  • 24 Feb 2011 - First release.
  • 26 Feb 2011 - Added Find/Replace functionality, indent stuff, showing of line numbers. Also added VB syntax highlighting.
  • 28 Feb 2011 - Added code folding functionality (include current block highlighting). Added some features (caret blinking, increase/decrease indent of selected text). Optimized ReplaceAll functionality. Added HTML syntax highlighting. Increased general performance of control.
  • 2 Mar 2011 - Style logic was revised. Added HTML export. Added many samples. Added many features...
  • 3 Mar 2011 - Increased performance. Fixed some bugs. Added SQL, PHP syntax highlighting examples. Brackets highlighting is built-in now. Some hotkeys was added.
  • 4 Mar 2011 - FastColoredTextBox now supports built-in syntax highlighter for languages: C#, VB, HTML, SQL, PHP.
  • 8 Mar 2011 - Added XML syntax descriptors. Fixed some bugs of font rendering.
  • 14 Mar 2011 - Added Backward/Forward navigation. Added IME mode and CJK languages support. Added powerful C# multitab editor sample.
  • 25 Mar 2011 - Added following features: colored text copy, auto indent for new line, insert/remove comment prefix for selected lines, uppercase/lowercase transformation of selected text. Fixed scroll flicker. Fixed some bugs. Added image drawing sample.
  • 7 Apr 2011 - Added AutocompleteMenu class. Autocomplete sample was revised. Some other features was added.
  • 15 Apr 2011 - AutoIndent was revised. Added printing functionality.
  • 30 May 2011 - Control was downgraded from FW3.5 to FW2.0.
  • 8 Jun 2011 - Added .NET Compact Framework 2.0 version. Added some features. Some bugs was fixed. Performance was increased.
  • 18 Jun 2011 - License was changed from GPLv3 to LGPLv3. Now you can use control in proprietary software.
  • 29 Jun 2011 - Changed behaviour of AutoIndent, Home key, word selection (Really, I made the PHP editor for myself, and discovered that these functions are inconvenient. Added some methods, events and properties (LineInserted, LineRemoved, Line.UniqueId). Added BookmarksSample. Built-in highlighter was improved. Fixed some flicker.
  • 17 Aug 2011 - Improved support for multiline comments and operators (see propertyHighlightingRangeType). Fixed some bugs.
  • 6 Jan 2012 - Some bugs was fixed. Autocomplete menu was improved.
  • 4 Feb 2012 - Added split-screen mode, lazy file loading, overwrite mode. Performance was increased. Some bugs was fixed.
  • 13 Mar 2012 - Added some properties and samples. Some bugs was fixed.
  • 30 Apr 2012 - Bugfixing, small changes of keys behaviour, selecting and autoindent.
  • 2 May 2012 - Column selection mode was added.
  • 26 Sep 2012 - Some bugs was fixed. Changed some key's behaviour. Added printing of line numbers. Added bilingual sample. Added hotkeys for remove current line and move selected lines up/down.
  • 03 Nov 2012 - Added properties: AutoIndentExistingLines (You can disable autoindenting for existing lines), VirtualSpace (In VirtualSpace mode user can set cursor into any position of textbox),FindEndOfFoldingBlockStrategy (You can adjust strategy of code folding). Added line selection mode(When user drags mouse over left margin of textbox, corresponding lines will be selected). Fixed some bugs with scrolling. Added HyperlinkSample.
  • 23 Jan 2013 - The control supports built-in Bookmarks, Tooltips and Hints. Event OnPaste was added. Fixed bugs with localization and binding to the Text property. AutocompleteMenu appearing was improved. Also behaviour of methods IncreaseIndent and DecreaseIndent was improved. Now you can change color scheme of built-in syntax highlighter (see properties KeywordStyle, StringStyle, etc.). Useful methodGetStylesOfChar() was added. SQL highlighting was extended. Some samples was improved. SampleHintSample was added. Drag&drop is available now.
  • 14 Feb 2013 - The control supports readonly blocks, zooming. Samples ReadOnlyBlocksSample andPredefinedStylesSample were added. Source codes of the component are available on GitHub now.
  • 26 Feb 2013 - Macros are supported now, MacrosSample was added. Implemented features: border around text area, char finding. Indenting was improved. Scrolling by mouse was improved.
  • 03 Mar 2013 - Added hotkey mapping. Now you can change hotkeys of FTCB. Also zooming and scrolling was improved.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)

 

 

posted on 2013-03-31 15:41  南南的博客  阅读(633)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3