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 / C++ / MFC
  4. how to display a colored text on controls?

how to display a colored text on controls?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
7 Posts 4 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.
  • O Offline
    O Offline
    olinn
    wrote on last edited by
    #1

    I want to manage some of my radio buttons and some of my static texts have colored text when the dialog receive a certain message, but other controls donot. How to do this? thanx.

    J V 2 Replies Last reply
    0
    • O olinn

      I want to manage some of my radio buttons and some of my static texts have colored text when the dialog receive a certain message, but other controls donot. How to do this? thanx.

      J Offline
      J Offline
      Joan M
      wrote on last edited by
      #2

      Take a look at CP, there are lots of articles regarding on this in the Static and into other sections... Hope this helps...

      https://www.robotecnik.com freelance robots, PLC and CNC programmer.

      1 Reply Last reply
      0
      • O olinn

        I want to manage some of my radio buttons and some of my static texts have colored text when the dialog receive a certain message, but other controls donot. How to do this? thanx.

        V Offline
        V Offline
        valikac
        wrote on last edited by
        #3

        What is the problem? What do you want to accomplish? Kuphryn

        O 1 Reply Last reply
        0
        • V valikac

          What is the problem? What do you want to accomplish? Kuphryn

          O Offline
          O Offline
          olinn
          wrote on last edited by
          #4

          make texts of the control or the static text have color

          V 1 Reply Last reply
          0
          • O olinn

            make texts of the control or the static text have color

            V Offline
            V Offline
            valikac
            wrote on last edited by
            #5

            One solution is to add a handler for ON_WM_CTLCOLOR. Kuphryn

            O 1 Reply Last reply
            0
            • V valikac

              One solution is to add a handler for ON_WM_CTLCOLOR. Kuphryn

              O Offline
              O Offline
              olinn
              wrote on last edited by
              #6

              Do you mean I should create a new class, inheriting from the orignal control class, for my control which I want to color its text. Then overridde the OnCtlColor function of the class, use CDC::SetTextColor to set the text color? I am not good at programing, please say it somewhat detailedly. Thanks a lot!

              R 1 Reply Last reply
              0
              • O olinn

                Do you mean I should create a new class, inheriting from the orignal control class, for my control which I want to color its text. Then overridde the OnCtlColor function of the class, use CDC::SetTextColor to set the text color? I am not good at programing, please say it somewhat detailedly. Thanks a lot!

                R Offline
                R Offline
                Ryan Binns
                wrote on last edited by
                #7

                olinn wrote: Do you mean I should create a new class, inheriting from the orignal control class, for my control which I want to color its text. Then overridde the OnCtlColor function of the class, use CDC::SetTextColor to set the text color? Yes, that would work. Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
                Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"

                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