School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!
You're Browsing As A Guest! Register Now...
Become an Expert!

Join 357,970 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,548 people online right now.Registration is fast and FREE... Join Now!



please help - C# RichTextBox syntax highlighting

52 Weeks of Code Challenge: Android

Week #11 of the 52 Weeks of Code Challenge is Android, you should give it a shot. Click Here!

please help - C# RichTextBox syntax highlighting can't get the 'comment highlighting' right.. Rate Topic: -----

#1 binary_refinary  Icon User is offline

  • New D.I.C Head
  • Pip

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 07-November 09


Dream Kudos: 0

Posted 07 November 2009 - 03:08 AM

Hi everybody,

i am new here, and i am also a beginner C# programmer (used to code in VB6-VB.NET for 6-8 years and moved on to C# just about a year ago)

first i would like to note that this is NOT a homework assignment :)


i am building a simple syntax highlighting method for a RichTextBox in a source code editor i am writing using C#+WinForms

i was having some issues with the basic highlighting , but than found an interesting tutorial here on DIC and it helped me to find where i was wrong - now works fine.

however,
i am trying to figure out how to make a single comment ( // ) highlighted right, and can't seem to get this right.


well as much as i understand, about highlighting a comment line it should be:

1. find a match for a '//'
2. change font color to desired color
3. let it stay at the same color for comment until found a '\n' (enter..new line)

or am i missing something?



i can not get this to work in RTB, with simple text its easy to find positions , starts and ends in a text array- but somehow in a rtb i find it harder to get done.


any help would be very much appreciated!

many thanks :-)

This post has been edited by binary_refinary: 07 November 2009 - 03:11 AM

Was This Post Helpful? 0
  • +
  • -



Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month