Click here to Skip to main content
Click here to Skip to main content

ColorTextBox

By , 25 Mar 2007
Rate this:
Please Sign up or sign in to vote.

Screenshot - colortextbox_pic.png

Introduction

ColorTextBox is a .NET 2.0 User Control which was written from scratch and is meant as a replacement for the TextBox control of the .NET class library.

Background

ColorTextBox is a by-product of LMX-Editor, an Open Source XML editor I developed as part of my diploma thesis. Since I was very disappointed by the performance of the RichTextBox control available in the .NET library (the standard TextBox does not support colored text), I decided to write my own ColorTextBox on which the aforementioned editor is based.

Using the code

Although ColorTextBox does not inherit from the abstract TextBoxBase class of the .NET library, it was designed to be compatible with the default TextBox implementation. So, if you're familiar with the usage of the standard TextBox, you can use ColorTextBox right away.

In fact, it should be no or little effort to replace TextBoxes in existing applications with instances of the ColorTextBox. If you develop under Visual Studio .NET 2005, you can use the Forms Designer to configure all relevant properties of the control.

Just look at the code provided in the example: it's a simple text editor which was built in about 30 minutes, and shows the most important features of the ColorTextBox.

Points of interest

As mentioned before, the ColorTextBox control is the base for an Open Source XML editor I wrote, which includes features like syntax highlighting and folding. If you want to write your own code editing component, have a look at the complete source code at SourceForge, which contains a generic CodeTextBox control which can be easily extended to support the mentioned features. Furthermore, the latest code for ColorTextBox will always be available under the link above!

History

03-08-07 Version 1.0.0:

  • Initial release
03-12-07 Version 1.0.1:
  • Added various keystroke shortcuts
  • Support for arbitrary input chars
03-25-07 Version 1.1.0:
  • Various bugfixes (Color support, Rendering, Scrolling, ...)
  • Added support for additional shortcut keys (similar to TextPad)
  • Added properties to improve compatability with the TextBox class
  • Added new demo application to demonstrate the most important features
  • Note: Some interfaces had to be changed!

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Chrisi476

Austria Austria
No Biography provided

Comments and Discussions

 
QuestionRead Only without cursor ? PinmemberWrangly6-Nov-13 2:51 
QuestionWhy not TextBoxBase? Pinmemberi0013-Nov-11 17:12 
GeneralMy vote of 5 PinmemberPreky1-May-11 12:12 
Generalselect(int, int) PinmemberMember 30574962-Jan-08 1:15 
General.SelectionBackColor property isn't in sync w/ rich text boxes Pinmembercipher_nemo1-Nov-07 9:23 
GeneralRe: .SelectionBackColor property isn't in sync w/ rich text boxes PinmemberChrisi4762-Nov-07 9:36 
QuestionNot working with KeyUp and KeyDown events? Pinmembercipher_nemo28-Oct-07 10:28 
AnswerRe: Not working with KeyUp and KeyDown events? Pinmembercipher_nemo29-Oct-07 7:03 
GeneralRe: Not working with KeyUp and KeyDown events? PinmemberChrisi4762-Nov-07 9:26 
GeneralFont anti-alias (ie: font smoothing, ClearType, etc.) Pinmembercipher_nemo28-Oct-07 7:40 
GeneralRe: Font anti-alias (ie: font smoothing, ClearType, etc.) PinmemberChrisi4762-Nov-07 9:22 
GeneralRe: Font anti-alias (ie: font smoothing, ClearType, etc.) Pinmembercipher_nemo12-Nov-07 4:31 
GeneralRe: Font anti-alias (ie: font smoothing, ClearType, etc.) PinmemberAki99911-Sep-08 1:53 
GeneralRe: Font anti-alias (ie: font smoothing, ClearType, etc.) PinmemberCor Hoender18-Feb-09 22:42 
Generalhi Pinmemberbalakpn30-Apr-07 3:57 
GeneralRe: hi PinmemberChrisi4767-May-07 1:34 
GeneralRe: hi Pinmembercipher_nemo28-Oct-07 7:04 
GeneralFont Property doesn't work ... PinmemberODanny17-Apr-07 2:39 
GeneralRe: Font Property doesn't work ... PinmemberChrisi47617-Apr-07 21:05 
GeneralRe: Font Property doesn't work ... PinmemberODanny17-Apr-07 21:18 
QuestionPassword? Pinmembernightrider131-Apr-07 11:27 
AnswerRe: Password? PinmemberChrisi4762-Apr-07 5:04 
GeneralRe: Password? Pinmembernightrider133-Apr-07 0:48 
GeneralRich Text Pinmembermo_kondori25-Mar-07 20:56 
GeneralRe: Rich Text PinmemberChrisi47626-Mar-07 2:07 
GeneralChanging color of text on screen Pinmembersanong21-Mar-07 0:40 
GeneralRe: Changing color of text on screen PinmemberChrisi47621-Mar-07 4:26 
GeneralRe: Changing color of text on screen [modified] PinmemberChrisi47621-Mar-07 8:11 
GeneralRe: Changing color of text on screen Pinmembersanong21-Mar-07 16:49 
GeneralRe: Changing color of text on screen PinmemberChrisi47625-Mar-07 11:44 
GeneralRe: Changing color of text on screen Pinmembersanong26-Mar-07 6:49 
GeneralIt's fast! but please fix the bugs PinmemberSAKryukov16-Mar-07 9:54 
GeneralRe: It's fast! but please fix the bugs PinmemberChrisi47617-Mar-07 5:26 
GeneralRe: It's fast! but please fix the bugs PinmemberSAKryukov19-Mar-07 11:10 
GeneralRe: It's fast! but please fix the bugs PinmemberChrisi47621-Mar-07 8:30 
GeneralCannot enter Polish letters. Pinmembervanad.min13-Mar-07 9:35 
GeneralRe: Cannot enter Polish letters. PinmemberChrisi47614-Mar-07 13:11 
QuestionWordwrap? PinmemberQuentin Pouplard8-Mar-07 23:13 
AnswerRe: Wordwrap? PinmemberChrisi4769-Mar-07 6:14 
QuestionRe: Wordwrap? Pinmemberlalaphilippe16-Nov-11 5:46 
QuestionSelect All (CTRL + A) and other Keys Shortcuts not supported (or Bug) ? PinmemberMiketrix8-Mar-07 21:12 
AnswerRe: Select All (CTRL + A) and other Keys Shortcuts not supported (or Bug) ? PinmemberChrisi4769-Mar-07 6:07 
GeneralRe: Select All (CTRL + A) and other Keys Shortcuts not supported (or Bug) ? Pinmemberemty2229-Feb-08 14:16 
GeneralKey for the source code on sourceforge Pinmemberuniquekaiser8-Mar-07 11:01 
GeneralRe: Key for the source code on sourceforge PinmemberChrisi4769-Mar-07 6:01 
Generalwritten from scratch PinmemberIan MacLean8-Mar-07 10:59 
GeneralRe: written from scratch PinmemberChrisi4769-Mar-07 5:41 
Generaljunk [modified] Pinmemberbug menot8-Mar-07 9:57 
GeneralRe: junk Pinmvptoxcct12-Mar-07 22:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140421.2 | Last Updated 25 Mar 2007
Article Copyright 2007 by Chrisi476
Everything else Copyright © CodeProject, 1999-2014
Terms of Use
Layout: fixed | fluid