That question was asked at the beginning of September last year. I would think they have figured it out by now.
Syntax Highlight in C# How to implement syntax highlighting in a WinForms application.
#18
Posted 01 February 2012 - 05:17 PM
By the way I had a syntax highlighter for my batch editor program that works kind of like this:
Which syntax highlighter is better?
[DllImport("user32.dll")]
public static extern bool LockWindowUpdate (IntPtr hWndLock);
private void work(string str, Color clr)
{
LockWindowUpdate(richTextBox1.Handle);
int startie = 0;
do
{
startie = richTextBox1.Find(str, startie, richTextBox1.Text.Length, RichTextBoxFinds.None);
if (startie > -1)
{
richTextBox1.Select(startie, str.Length);
richTextBox1.SelectionColor = clr;
richTextBox1.SelectedText = str;
startie++;
}
} while (startie > -1);
richTextBox1.DeselectAll();
richTextBox1.Select(richTextBox1.Text.Length, 0);
LockWindowUpdate(IntPtr.Zero);
}
public void Highlight(Dictionary<string, Color> words)
{
foreach (string item in words.Keys)
{
Color key;
words.TryGetValue(item, key);
if (!key == null)
{
work(item, key);
}
}
}
/*
Sorry about the terrible indentation. I had this for my batch editor before I saw this but I added the lockwindowupdate thing because I thought it might help keep my window from higlighting randomized words out of nowhere.
PS: The method Highlight is called on richTextBox1_TextChanged with a dictionary of batch keywords and colors.
*/
Which syntax highlighter is better?
|
|





MultiQuote


|