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. Changing background color of dialog

Changing background color of dialog

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

    How to change the backgound color of a dialog? The function SetDialogBkColor() is obsolete, so it cannot be used.

    V 1 Reply Last reply
    0
    • D dart13

      How to change the backgound color of a dialog? The function SetDialogBkColor() is obsolete, so it cannot be used.

      V Offline
      V Offline
      vividtang
      wrote on last edited by
      #2

      hey:i can give you some little help HBRUSH CMyTest::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) {if (nCtlColor = CTLCOLOR_STATIC ) { pDC->SetBkColor(RGB(255,0,0)); pDC->SetBkMode(TRANSPARENT); HBRUSH B = CreateSolidBrush(RGB(255,255,0)); return (HBRUSH) B;} } running ok

      D 2 Replies Last reply
      0
      • V vividtang

        hey:i can give you some little help HBRUSH CMyTest::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) {if (nCtlColor = CTLCOLOR_STATIC ) { pDC->SetBkColor(RGB(255,0,0)); pDC->SetBkMode(TRANSPARENT); HBRUSH B = CreateSolidBrush(RGB(255,255,0)); return (HBRUSH) B;} } running ok

        D Offline
        D Offline
        dart13
        wrote on last edited by
        #3

        I suppose that this code changes the bkg color of controls. However, I need to change the bkg color of a dialog window.

        1 Reply Last reply
        0
        • V vividtang

          hey:i can give you some little help HBRUSH CMyTest::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) {if (nCtlColor = CTLCOLOR_STATIC ) { pDC->SetBkColor(RGB(255,0,0)); pDC->SetBkMode(TRANSPARENT); HBRUSH B = CreateSolidBrush(RGB(255,255,0)); return (HBRUSH) B;} } running ok

          D Offline
          D Offline
          dart13
          wrote on last edited by
          #4

          Thanx, I tried the code and it works. When I first looked at it I thought it was for controls, but when I tried it worked.

          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