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. Change color of controls of a dialog

Change color of controls of a dialog

Scheduled Pinned Locked Moved C / C++ / MFC
csharptutorial
6 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.
  • W Offline
    W Offline
    Ward 0
    wrote on last edited by
    #1

    I can change the background colors of child controls of a dialog by responding to the WM_CTLCOLORxxx messages Example: case WM_CTLCOLORBTN: hBrushButton = CreateSolidBrush(RGB(255,102,15)); return (int)hBrushButton; Now I'm looking for a way to change the textcolor as well. This for buttons, labels, listboxes, ... Thanks in advance, Ward http://users.belgacom.net/wardvantichelen

    T 1 Reply Last reply
    0
    • W Ward 0

      I can change the background colors of child controls of a dialog by responding to the WM_CTLCOLORxxx messages Example: case WM_CTLCOLORBTN: hBrushButton = CreateSolidBrush(RGB(255,102,15)); return (int)hBrushButton; Now I'm looking for a way to change the textcolor as well. This for buttons, labels, listboxes, ... Thanks in advance, Ward http://users.belgacom.net/wardvantichelen

      T Offline
      T Offline
      ThatsAlok
      wrote on last edited by
      #2

      Check these api's [SetTextColor],[SetBkColor]

      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

      cheers, Alok Gupta

      W 1 Reply Last reply
      0
      • T ThatsAlok

        Check these api's [SetTextColor],[SetBkColor]

        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

        cheers, Alok Gupta

        W Offline
        W Offline
        Ward 0
        wrote on last edited by
        #3

        That helped me. Thanks! My code is now the following: case WM_CTLCOLORSTATIC: hBrushButton = CreateSolidBrush(RGB(255,102,15)); SetTextColor((HDC) wParam, RGB(255,255,255)); SetBkColor((HDC) wParam, RGB(255,102,15)); return (int)hBrushButton; This results is a nice orange label with white text.:) Greetz, Ward See more from me at http://users.belgacom.net/wardvantichelen

        C T 2 Replies Last reply
        0
        • W Ward 0

          That helped me. Thanks! My code is now the following: case WM_CTLCOLORSTATIC: hBrushButton = CreateSolidBrush(RGB(255,102,15)); SetTextColor((HDC) wParam, RGB(255,255,255)); SetBkColor((HDC) wParam, RGB(255,102,15)); return (int)hBrushButton; This results is a nice orange label with white text.:) Greetz, Ward See more from me at http://users.belgacom.net/wardvantichelen

          C Offline
          C Offline
          Cedric Moonen
          wrote on last edited by
          #4

          Ward wrote: This results is a nice orange label with white text. :doh: Are you trying to make a copy of code project :-) ?

          W 1 Reply Last reply
          0
          • C Cedric Moonen

            Ward wrote: This results is a nice orange label with white text. :doh: Are you trying to make a copy of code project :-) ?

            W Offline
            W Offline
            Ward 0
            wrote on last edited by
            #5

            Hihihi! I've never thought that I was using the same colors. Nice reply though! Ward:laugh: http://users.belgacom.net/wardvantichelen

            1 Reply Last reply
            0
            • W Ward 0

              That helped me. Thanks! My code is now the following: case WM_CTLCOLORSTATIC: hBrushButton = CreateSolidBrush(RGB(255,102,15)); SetTextColor((HDC) wParam, RGB(255,255,255)); SetBkColor((HDC) wParam, RGB(255,102,15)); return (int)hBrushButton; This results is a nice orange label with white text.:) Greetz, Ward See more from me at http://users.belgacom.net/wardvantichelen

              T Offline
              T Offline
              ThatsAlok
              wrote on last edited by
              #6

              Ward wrote: Thanks! Mention Not!

              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

              cheers, Alok Gupta

              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