locked
Dialog Background Color? RRS feed

  • Question

  • Hello Folks:

       Developing on Windows 10 Pro, Win32, no MFC. 

       I'm drawing some marks on a dialog.  I want to erase them by drawing the same marks using GetBkColor() for the dialog's HDC. 

       GetBkColor() returns white, 0xFFFFFF instead of the light gray. 

       How do I find that color, or whatever color is used to draw the dialog?

       Thanks
       Larry

    Friday, July 10, 2020 11:53 AM

Answers

All replies

  • How about GetDCBrushColor?
    Friday, July 10, 2020 12:19 PM
  • Try GetSysColor with COLOR_3DFACE.

    • Marked as answer by a_unique_name Friday, July 10, 2020 4:04 PM
    Friday, July 10, 2020 12:27 PM
  • The default color is 

     GetSysColor(COLOR_3DFACE);

    • Marked as answer by a_unique_name Friday, July 10, 2020 4:04 PM
    Friday, July 10, 2020 12:31 PM
  • Thanks David:

       That returns 0xFFFFFF.

       I appreciate the effort though.

          Larry


    Friday, July 10, 2020 4:06 PM
  • Thanks RLWA32:

       That does it.  I couldn't remember the GetSysColor() function. 

          Larry


    Friday, July 10, 2020 4:07 PM
  • Thanks Castorix31:

       That works.

          Larry

    Friday, July 10, 2020 4:13 PM
  • Larry,

    Just a point to consider - if the dialog's background is using a custom brush (for whatever reason), the color won't be what the default is.

    I think you'd need to let the default background painting take place to erase things.

    Sunday, July 12, 2020 12:13 PM