Skip to content

b-dmitry1/SourceEditor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SourceEditor

  • Syntax highlighting
  • Keyboard and mouse control
  • Cut, Copy, Paste, Delete
  • Text block drag and drop
  • Zooming with Ctrl+Wheel
  • Undo

Appearance

Defining a keywords:

editor.Keywords = new string[] { "for", "while", "do", "continue", "break", "switch", "if", "else" };

Defining a common identifiers:

editor.Identifiers = new string[] { "text", "font", "zoom", "width", "height" };

Defining single line comment symbol:

editor.SingleLineComment = "--";

Custom color scheme

The highlighter uses 6 default colors:

  • Keywords (LightSkyBlue)
  • Comments (LightGreen)
  • Strings (PeachPuff)
  • Punctuation (LemonChiffon)
  • Identifiers (Moccasin)
  • Default (WhiteSmoke)

To change default colors:

editor.SetColor(Keywords, Color.Blue);

Also you can change:

  • BackColor
  • SelectionColor
  • ScrollBarColor
  • ScrollBarThumbColor
  • ScrollBarWidth

Methods

// Cursor position
void MoveCursor(int line, int symbol);

// Load and Save
void LoadFromFile(string fileName);
void SaveToFile(string fileName);

// Clipboard and selection
void Cut();
void Copy();
void Paste();
void ClearSelection();

// Undo
void Undo();

// Keyboard input simulation:
void AddChar(char ch);
void DeleteChar();

// And this should be called if you modify Lines manually:
void LinesChanged(int first, int count);

 

Screenshot

About

Custom text editor with syntax highlighting

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages