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. Background color

Background color

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorial
4 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.
  • G Offline
    G Offline
    goodoljosh1980
    wrote on last edited by
    #1

    Anyone have an idea how to find the RGB value of the default MFC dialog. I am building a program and need to know what color the screen comes up as so that after I am done using the CDC->TextOut command, I can call it again with a font of the same color as the background. Please advise. Thank you.

    S H 2 Replies Last reply
    0
    • G goodoljosh1980

      Anyone have an idea how to find the RGB value of the default MFC dialog. I am building a program and need to know what color the screen comes up as so that after I am done using the CDC->TextOut command, I can call it again with a font of the same color as the background. Please advise. Thank you.

      S Offline
      S Offline
      SimonSays
      wrote on last edited by
      #2

      Well, I believe that the background color is GetSysColor(COLOR_3DFACE), as long as XP Visual Styles don't come into play -- they it could be anything, including a bitmap. You would be better served to just call dc->SetBkMode(TRANSPARENT) and just draw transparent text.

      G 1 Reply Last reply
      0
      • S SimonSays

        Well, I believe that the background color is GetSysColor(COLOR_3DFACE), as long as XP Visual Styles don't come into play -- they it could be anything, including a bitmap. You would be better served to just call dc->SetBkMode(TRANSPARENT) and just draw transparent text.

        G Offline
        G Offline
        goodoljosh1980
        wrote on last edited by
        #3

        :)I was using the SetBkMode(Transparent) call, but I wanted to be able to find the color of the background so that I could clean up the screen by simply calling the same TextOut function, but with the background color to effectively "mask" away the text I already painted. The GetSysColor function seems to be working. Thanks for the information.

        1 Reply Last reply
        0
        • G goodoljosh1980

          Anyone have an idea how to find the RGB value of the default MFC dialog. I am building a program and need to know what color the screen comes up as so that after I am done using the CDC->TextOut command, I can call it again with a font of the same color as the background. Please advise. Thank you.

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

          See GetBkColor(GetDC()->m_hDC)_**


          **_

          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