![]() |
Desktop Development »
Edit Controls »
General
Intermediate
License: The Code Project Open License (CPOL)
CodeTextBox - another RichTextBox control with syntax highlightning and intellisenseBy Tamas HonfiA RichTextBox control with syntax highlightning and intellisense. |
C# (C# 1.0, C# 2.0, C# 3.0), Windows, .NET, Dev
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||

I needed a script-editor control for one of my projects, with syntax highlighting and intellisense for more comfort. I did a search on CodeProject and Google, but didn't find any - just separate solutions for one of the two functions... The one I found with both syntax highlighting and intellisense just wasn't flexible enough for me, because it could be used only for C#, and only could handle classes (intellisense popped up after pressing the . key). As I wanted to use this mostly for LUA, this simply wasn't enough. I decided to use this control as a sample, and write my own, flexible one... After a few days, I came out with this: I have a flexible syntax-highlighter, with intellisense. :) I can edit everything in design mode, for example, the intellisense hotkey, or the scope-operator's list... Yes, I can handle not just the point, but more like ::, or ->, with C++ language support in mind. :)
I designed the CodeTextBox control to be easy to work with: you can edit all the necessary properties in design mode as well, under the CodeTextBox category.

There're some things that I couldn't do automatically, or put in Design mode...
CodeTextBox programmatically, you should update syntax highlighting to get the proper results.You can do it like this: codeTextBox1.UpdateSyntaxHightlight();.
TreeView control to store intellisense's data. I know it's a waste of resources, but it was a fast solution for now, and I need to give some instructions on how to use it, because there's a lot of things there...To build up the intellisense-tree, you should add items to the intellisense-tree's nodes. I use the node's Name and Tag attributes for intellisense. Name should contain the name of the intellisense item, Tag should contain one of the following: class, event, interface, namespace, method, or property. Intellisense will assign images before the names based on this Tag property.
I know that it's not perfect yet, but hey, it's useable... :) Let me tell you some ideas to make this better, and also some of its limitations that I haven't been able to solve until now...
As in most syntax highlighters, I cannot handle C-style comment blocks, and keywords like #region.
TreeView with a tinier container, but keeping the easy design-time edit function that TreeView has.ImageListBox class for the intellisense box: Where's the ImageCombo control?| You must Sign In to use this message board. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 8 Sep 2008 Editor: Smitha Vijayan |
Copyright 2008 by Tamas Honfi Everything else Copyright © CodeProject, 1999-2009 Web21 | Advertise on the Code Project |