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. coloured lines in a multilined textbox

coloured lines in a multilined textbox

Scheduled Pinned Locked Moved C#
help
5 Posts 3 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.
  • M Offline
    M Offline
    maheshfour
    wrote on last edited by
    #1

    hi friends. i am facing a problem.:( i want to display some text in a multilined texebox. actually its a text box, displaying some status. I want to show different color text for some perticular status. i tried using the color property of the textbox, but it changes the color of the entire box. please help.

    A R 2 Replies Last reply
    0
    • M maheshfour

      hi friends. i am facing a problem.:( i want to display some text in a multilined texebox. actually its a text box, displaying some status. I want to show different color text for some perticular status. i tried using the color property of the textbox, but it changes the color of the entire box. please help.

      A Offline
      A Offline
      Anonymous
      wrote on last edited by
      #2

      Get a textbox that supports multiple colours. Either that, or I remember doing this years back in vb4 (with extras) using subclassing to do the job. If i remember rightly i trapped the paint event, got the position for the line i wanted to colour etc and printed the new coloured text directly over the exiting one in the listbox. This worked surprisingly well especially since I only did it to piss off a mate who said making colour listboxes was the only thing he couldn't do :-)

      1 Reply Last reply
      0
      • M maheshfour

        hi friends. i am facing a problem.:( i want to display some text in a multilined texebox. actually its a text box, displaying some status. I want to show different color text for some perticular status. i tried using the color property of the textbox, but it changes the color of the entire box. please help.

        R Offline
        R Offline
        Robert Rohde
        wrote on last edited by
        #3

        Have a look at the RichTextBox control coming with the framework.

        M 1 Reply Last reply
        0
        • R Robert Rohde

          Have a look at the RichTextBox control coming with the framework.

          M Offline
          M Offline
          maheshfour
          wrote on last edited by
          #4

          how is rich text box different from the normal one? what properties of the rich text box can i use?

          R 1 Reply Last reply
          0
          • M maheshfour

            how is rich text box different from the normal one? what properties of the rich text box can i use?

            R Offline
            R Offline
            Robert Rohde
            wrote on last edited by
            #5

            The RichTextBox can display documents in rtf format. Create a Word document, save it as rtf and load it into the richtextbox and youll see that it is rathe rpowerful. To understand how the text must be build to make certain formattings or colors I would suggest that you make samples of what you try to achieve in word and then look into the Rtf property. To just change the color (and also some other properties) of specific words or lines the following way is the easiest: 1. Call the Select method to select some part of the displayed text. 2. Set the SelectionColor property to change the color of the selected text.

            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