RichTextBox questions?
-
1. How do I determine on which row/line/ is the cursor? 2. How can I set a background color of a line?
Cristoff wrote:
1. How do I determine on which row/line/ is the cursor?
GetCharIndexFromPosition
will accept some coordinates and return the index of the character under that point.GetLineFromCharIndex
will get the line from the character index. (Try consulting the help documentation or even just looking through the intellisense, the method names are quite simple :rolleyes:)Cristoff wrote:
2. How can I set a background color of a line?
Unless you override the painting of the control there is no built-in way to do this. Take a look at some of the articles regarding the
RichTextBox
here on CP for ideas on how to do this. (There is one I remember that draws the line numbers, should be quite simple to re-write this to background fill the lines).
You know you're a Land Rover owner when the best route from point A to point B is through the mud. Ed
-
Cristoff wrote:
1. How do I determine on which row/line/ is the cursor?
GetCharIndexFromPosition
will accept some coordinates and return the index of the character under that point.GetLineFromCharIndex
will get the line from the character index. (Try consulting the help documentation or even just looking through the intellisense, the method names are quite simple :rolleyes:)Cristoff wrote:
2. How can I set a background color of a line?
Unless you override the painting of the control there is no built-in way to do this. Take a look at some of the articles regarding the
RichTextBox
here on CP for ideas on how to do this. (There is one I remember that draws the line numbers, should be quite simple to re-write this to background fill the lines).
You know you're a Land Rover owner when the best route from point A to point B is through the mud. Ed
-
:) Thank you! I'm just starting this stuff again and I'm lost! I think I found the article! I don't know why I wasn't able to find it before???? Great line about Land Rover! -- modified at 15:22 Sunday 14th May, 2006
Try: Numbered TextBox CP search didn't work so this was found through Google, limiting the search to www.codeproject.com. [edit]While I was looking for the article it looks like you found it, hopefully it's the same one[/edit]
Cristoff wrote:
Great line about Land Rover!
Thanks :), I can prove this from experience :rolleyes:
You know you're a Land Rover owner when the best route from point A to point B is through the mud. Ed
-
Try: Numbered TextBox CP search didn't work so this was found through Google, limiting the search to www.codeproject.com. [edit]While I was looking for the article it looks like you found it, hopefully it's the same one[/edit]
Cristoff wrote:
Great line about Land Rover!
Thanks :), I can prove this from experience :rolleyes:
You know you're a Land Rover owner when the best route from point A to point B is through the mud. Ed
Ed.Poore wrote:
Try: Numbered TextBox CP search didn't work so this was found through Google, limiting the search to www.codeproject.com. [edit]While I was looking for the article it looks like you found it, hopefully it's the same one[/edit]
Thank you! I haven't used codeproject site for quite some time and I haven't searched correctly.
Cristoff wrote: Great line about Land Rover! Thanks , I can prove this from experience
I know too I always have to suppress my hooliganish instincts and try to behave civilized.