Vote count:
0
i have created a Code Viewer in winforms using richtextbox, it is possible to comment out any selected text that i want to comment out? thanks!
here's my code
public Regex keyWords = new Regex("abstract|as|base|bool|break|byte|case|catch");
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
int selPos = richTextBox1.SelectionStart;
foreach (Match keyWordMatch in keyWords.Matches(richTextBox1.Text))
{
richTextBox1.Select(keyWordMatch.Index, keyWordMatch.Length);
richTextBox1.SelectionColor = Color.Blue;
richTextBox1.SelectionStart = selPos;
richTextBox1.SelectionColor = Color.Black;
}
}
asked 14 secs ago
sample of comment out from codeeditor in winforms
Aucun commentaire:
Enregistrer un commentaire