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. Richtext Box question

Richtext Box question

Scheduled Pinned Locked Moved C#
question
7 Posts 6 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.
  • B Offline
    B Offline
    Beringer
    wrote on last edited by
    #1

    Has anybody ever drawn the red squigly lines that show up say in Word or other apps under a word when it is misspelled? I have come up with a way but it is not reliable to underline all words. My method gets messed up with tab chars and also hidden text. I suspect the same would be true for tables and inserted pictures. Thanks in advance, Eric

    J A B M 4 Replies Last reply
    0
    • B Beringer

      Has anybody ever drawn the red squigly lines that show up say in Word or other apps under a word when it is misspelled? I have come up with a way but it is not reliable to underline all words. My method gets messed up with tab chars and also hidden text. I suspect the same would be true for tables and inserted pictures. Thanks in advance, Eric

      J Offline
      J Offline
      James Gupta
      wrote on last edited by
      #2

      From my knowledge, it is not directly possible to use the rtb class to draw the Office-Style underlines. However, you can have an effective selection method by saving the selected text and creating custom functions to get text from it - even with hidden text

      1 Reply Last reply
      0
      • B Beringer

        Has anybody ever drawn the red squigly lines that show up say in Word or other apps under a word when it is misspelled? I have come up with a way but it is not reliable to underline all words. My method gets messed up with tab chars and also hidden text. I suspect the same would be true for tables and inserted pictures. Thanks in advance, Eric

        A Offline
        A Offline
        Allah On Acid
        wrote on last edited by
        #3

        I think you would probably have to directly draw the lines on the control, either using RichTextBox.CreateGraphis() or by creating a class that inherits from RichTextBox, and overriding RichtextBox.OnPaint

        1 Reply Last reply
        0
        • B Beringer

          Has anybody ever drawn the red squigly lines that show up say in Word or other apps under a word when it is misspelled? I have come up with a way but it is not reliable to underline all words. My method gets messed up with tab chars and also hidden text. I suspect the same would be true for tables and inserted pictures. Thanks in advance, Eric

          B Offline
          B Offline
          Beringer
          wrote on last edited by
          #4

          Its possible to draw the line using the approach mentioned. However, the difficulty I'm having is reliably calculating the coordinates of the beginning of the word that needs to be marked with the squiggly. Any suggestions there? Thanks again, Eric

          D S 2 Replies Last reply
          0
          • B Beringer

            Its possible to draw the line using the approach mentioned. However, the difficulty I'm having is reliably calculating the coordinates of the beginning of the word that needs to be marked with the squiggly. Any suggestions there? Thanks again, Eric

            D Offline
            D Offline
            DigitalKing
            wrote on last edited by
            #5

            Use the GetPositionFromCharIndex method.

            1 Reply Last reply
            0
            • B Beringer

              Has anybody ever drawn the red squigly lines that show up say in Word or other apps under a word when it is misspelled? I have come up with a way but it is not reliable to underline all words. My method gets messed up with tab chars and also hidden text. I suspect the same would be true for tables and inserted pictures. Thanks in advance, Eric

              M Offline
              M Offline
              mav northwind
              wrote on last edited by
              #6

              Hi! The Rich Edit control that's actually the core control underneath the RichTextBox can display underlines (even the squiggly ones), but setting the corresponding character styles is not possible directly with the regular RichTextBox. You'll have to send EM_SETCHARFORMAT messages to the rtb to enable underlining in a given style. You can't have an underline color that's different from the text foreground color, though. You might want to look up the CHARFORMAT2 structure in the Platform SDK documentation on the different options you have to underline text within a rich edit control (and thus in a RichTextBox). Regards, mav -- modified at 7:47 Saturday 4th February, 2006 Just found out that my statement on the underline color was incorrect. You CAN have different underline colors, althouth it's not documented in the CHARFORMAT2 struct. The upper 4 bits of the bUnderlineType determine the color.

              1 Reply Last reply
              0
              • B Beringer

                Its possible to draw the line using the approach mentioned. However, the difficulty I'm having is reliably calculating the coordinates of the beginning of the word that needs to be marked with the squiggly. Any suggestions there? Thanks again, Eric

                S Offline
                S Offline
                Saravanan_article
                wrote on last edited by
                #7

                Will u please post the code!!!!!!!!

                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