Click to See Complete Forum and Search --> : Syntax highlighting in a rich textbox


DnyanAnand
February 14th, 2008, 04:40 AM
Hi dahwan,

i hav to do some coloring in the richtextBox as shown in the image,

so plz will u see it in the picture attached for ur refenrce..


so plz help me for this stuff.........

i m realy so much woring about it.........


Thanx in advance

Brad Jones
February 14th, 2008, 10:12 AM
DnyanAnand -

I've moved your post to a new thread of its own. Please do not post the same question multiple times. Also, please do not take over someone else's thread with a new question.

Brad!

jon.borchardt
February 18th, 2008, 07:15 PM
You can do a find for the 'words' you want to color
then set the font and color for the selection

example
richTextBox.Find("class", RichTextBoxFinds.MatchCase);
richTextBox.SelectionFont = new Font("Verdana", 12, FontStyle.Bold);
richTextBox.SelectionColor = Color.Blue;

DnyanAnand
February 19th, 2008, 11:19 PM
Hi jon.borchardt,

i dont have to color to the text only, but the whole line in which the text contain......

now u will tell me like that select whole line text & color it, but so sorry i dont want do this also.

i want to color from left of richtextbox to the whole width of the richtext box as shown in the picture.

just see in the picture for text "int mouseX,mouseY;"
containx this much text but its background is colored
from start to the width of richtextbox.

so plz help me for this stuff.

i m so much thanx in advance.

Best Regards
DnyanAnand

jon.borchardt
February 23rd, 2008, 08:35 PM
I'm not sure how you can do that...
I would begin by making a custom control that extends the richtextbox
then override the paint function...
Good luck

dglienna
February 23rd, 2008, 09:28 PM
You *might* be able to make a Word Template, and save it as RTF format.

http://www.vbaexpress.com/kb/getarticle.php?kb_id=436