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. Dialog Application-Adding Color to Display Data

Dialog Application-Adding Color to Display Data

Scheduled Pinned Locked Moved C / C++ / MFC
questiondata-structureshelp
7 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.
  • J Offline
    J Offline
    jerry1211a
    wrote on last edited by
    #1

    Hi, I have a Dialog application. In some cases I am displaying data in the main dialog by accessing data in an array: str2.Format("%02d\t, m_Parse.mChannel[i].m_SV); str+=str2; SetDlgItemText(IDC_SAT, str); etc. etc. What I want to do is to have some of the data displayed in different colors other than black. How can I set the color of some data before displaying it? Can someone help me out? :) Jerry

    M H 2 Replies Last reply
    0
    • J jerry1211a

      Hi, I have a Dialog application. In some cases I am displaying data in the main dialog by accessing data in an array: str2.Format("%02d\t, m_Parse.mChannel[i].m_SV); str+=str2; SetDlgItemText(IDC_SAT, str); etc. etc. What I want to do is to have some of the data displayed in different colors other than black. How can I set the color of some data before displaying it? Can someone help me out? :) Jerry

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      I think the only control that would allow you to mix colors in the text would be a rich edit control. You could use read-only rich edit controls. If that's way overkill for just colored text, you could render the text yourself in response to the WM_PAINT message using perhaps some/all of these functions: SelectObject() to select a NULL brush (NULL_BRUSH) into the DC or possibly another font as well SetTextColor() SetROP2() to set the foreground mixing mode (to R2_COPYPEN, for example) SetBkMode() to set the background mixing mode (to TRANSPARENT, for example) DrawText() to draw the text Just two possibilities Mark

      1 Reply Last reply
      0
      • J jerry1211a

        Hi, I have a Dialog application. In some cases I am displaying data in the main dialog by accessing data in an array: str2.Format("%02d\t, m_Parse.mChannel[i].m_SV); str+=str2; SetDlgItemText(IDC_SAT, str); etc. etc. What I want to do is to have some of the data displayed in different colors other than black. How can I set the color of some data before displaying it? Can someone help me out? :) Jerry

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #3

        Whats your control?


        WhiteSky


        J 1 Reply Last reply
        0
        • H Hamid Taebi

          Whats your control?


          WhiteSky


          J Offline
          J Offline
          jerry1211a
          wrote on last edited by
          #4

          A text control. Jerry

          H 1 Reply Last reply
          0
          • J jerry1211a

            A text control. Jerry

            H Offline
            H Offline
            Hamid Taebi
            wrote on last edited by
            #5

            if your control is Edit see WM_CTLCOLOREDIT


            WhiteSky


            J 1 Reply Last reply
            0
            • H Hamid Taebi

              if your control is Edit see WM_CTLCOLOREDIT


              WhiteSky


              J Offline
              J Offline
              jerry1211a
              wrote on last edited by
              #6

              Ok I will take a look at that...thanks, have a good day. :) Jerry

              H 1 Reply Last reply
              0
              • J jerry1211a

                Ok I will take a look at that...thanks, have a good day. :) Jerry

                H Offline
                H Offline
                Hamid Taebi
                wrote on last edited by
                #7

                And see MSDN WM_CTLCOLOR notification.It has an example and also you can see another CTLCOLOR_*:)


                WhiteSky


                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