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. Cganging Dialog Box Color

Cganging Dialog Box Color

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorial
6 Posts 5 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.
  • P Offline
    P Offline
    progvc
    wrote on last edited by
    #1

    Hi, In a MFC dialog Based Application, I want to change the color of the Dialog Box, as soon as it appears on the screen. Can u suggest how to achieve this............. Regs

    J T 2 Replies Last reply
    0
    • P progvc

      Hi, In a MFC dialog Based Application, I want to change the color of the Dialog Box, as soon as it appears on the screen. Can u suggest how to achieve this............. Regs

      J Offline
      J Offline
      Jetli Jerry
      wrote on last edited by
      #2

      Override OnEraseBkgnd(CDC* pDC) E.g. #define DLG_BACK_COLOR RGB(255,0,0) BOOL CYourDlg::OnEraseBkgnd(CDC* pDC) { CRect rect; GetClientRect(&rect); CBrush brush(DLG_BACK_COLOR); pDC->FillRect(rect,&brush); return TRUE; } HTH Jetli Constant Thing In World Is Change.

      J 1 Reply Last reply
      0
      • J Jetli Jerry

        Override OnEraseBkgnd(CDC* pDC) E.g. #define DLG_BACK_COLOR RGB(255,0,0) BOOL CYourDlg::OnEraseBkgnd(CDC* pDC) { CRect rect; GetClientRect(&rect); CBrush brush(DLG_BACK_COLOR); pDC->FillRect(rect,&brush); return TRUE; } HTH Jetli Constant Thing In World Is Change.

        J Offline
        J Offline
        Jorgen Sigvardsson
        wrote on last edited by
        #3

        also handle WM_CTLCOLORSTATIC to give static text boxes the same background color -- Look straight into the light!

        1 Reply Last reply
        0
        • P progvc

          Hi, In a MFC dialog Based Application, I want to change the color of the Dialog Box, as soon as it appears on the screen. Can u suggest how to achieve this............. Regs

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

          Handle WM_CTLCOLOR message in your Dialog to paint dialog with color of your choice

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

          cheers, Alok Gupta VC Forum Q&A :- I/ IV

          A P 2 Replies Last reply
          0
          • T ThatsAlok

            Handle WM_CTLCOLOR message in your Dialog to paint dialog with color of your choice

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

            cheers, Alok Gupta VC Forum Q&A :- I/ IV

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

            Hi, Thanks to all of you for your reply.Now I got it as per your suggesstion.

            1 Reply Last reply
            0
            • T ThatsAlok

              Handle WM_CTLCOLOR message in your Dialog to paint dialog with color of your choice

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

              cheers, Alok Gupta VC Forum Q&A :- I/ IV

              P Offline
              P Offline
              progvc
              wrote on last edited by
              #6

              Hi, Thanks for the reply. Now the problem is solved as per the suggesstion made by all of you.

              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