Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. RichTextBox questions?

RichTextBox questions?

Scheduled Pinned Locked Moved C#
question
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Cristoff
    wrote on last edited by
    #1

    1. How do I determine on which row/line/ is the cursor? 2. How can I set a background color of a line?

    E 1 Reply Last reply
    0
    • C Cristoff

      1. How do I determine on which row/line/ is the cursor? 2. How can I set a background color of a line?

      E Offline
      E Offline
      Ed Poore
      wrote on last edited by
      #2

      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

      C 1 Reply Last reply
      0
      • E Ed Poore

        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

        C Offline
        C Offline
        Cristoff
        wrote on last edited by
        #3

        :) 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

        E 1 Reply Last reply
        0
        • C Cristoff

          :) 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

          E Offline
          E Offline
          Ed Poore
          wrote on last edited by
          #4

          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

          C 1 Reply Last reply
          0
          • E Ed Poore

            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

            C Offline
            C Offline
            Cristoff
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups