I am working on an application for a programmer (he uses HTML, JavaScript,
Perl, and so on...). I won't be distributing this app, so absolute
perfection is not required (though it would be nice :-D). One complaint he
had about writing scripts in Notepad was that the keywords were not color
coded (for obvious reasons: Notepad was not created with script writers in
mind). He wants HTML tags (such as <HTML> and <BODY>) to automatically be
colored red as he types. (The tags and keywords that he wants to be colored
would be stored in a file, one keyword per line.) I would think that this
type of problem would best be solved by using a RichTextBox, correct? What
type of code would I use to accomplish this?
Also, another feature that is necessary is line numbering. I didn't want to
put the numbers in the actual coding text box, so instead I used the
GetUpperBound function of the RichTextBox.Lines property to place the line
numbers in a non-editable text box to the left of the one used for code.
This works fine with WordWrap turned off, but when it's turned on, the
numbers often become unaligned with the lines of code (because one line of
code may take more than one line in the text box). Also, when I scroll down
on the code text box, is there a way for the line numbers text box to
automatically scroll down in sync with it (the line number text box has no
scroll bars, and I would rather not change that)? Thanks in advance.