|
-
Feb 15th, 2013, 04:07 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] How to find index of line in RichTextBox?
Okay, I've got a RichTextBox that the user enters data into. In this case, multiple lines from a script. I want to auto-detect if a line in the rtb is a line of dialogue in the play, i.e. does it begin with a character's name (I keep the names in a separate list). Detecting that is simple... I loop through the rtb.Lines and compare the beginning of each line to each name in the character array. The problem begins when I find a match... Let's say I want to make the first ten characters of line #7 bold... how? The way I know how to select characters and change the font of that selection depends upon a selection range that deals with absolute character position, not relative to a line number. So, is there an easy way to determine the index of a line, ex: lnie #7 begins at position 87 and ends at position 94? Or better yet, to say select text beginning at line #7, character 0, for 10 characters?
Honestly, it seems like it should be easy to do this... else why supply the .Lines in the first place? But I honestly cannot find it.
For the record, I'm using VS2010 and .NET 4.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|