locked
How to get black color font in deskband for Aero themes with different window color RRS feed

  • Question

  • Hi,

     My deskband consist of combo box and toolbar button. I assigned black color font for combo box text but in Aero themes the the text are not displaying with black color.

    I created the combo box using predefined create funtion and assigned black color for font using setFont().(i.e. my combobox is not customized control).

    Please anyone help me on how to get black color in Aero themes also.

    Thanks.


    • Edited by rmgs123 Tuesday, July 31, 2012 1:18 PM
    Tuesday, July 31, 2012 1:16 PM

Answers

  • The easiest workaround would be using instead of the color 0x00000000 (COLORREF value) the color 0x00010101. It is almost black and the DWM will not intepret this color to make it transparent.

    If you really want to handle black (RGB value 0,0,0) you have to use GDI+ and also work with the alpha channel that GDI+ supports.

    Wednesday, August 1, 2012 5:16 AM
  • I'm not sure if handling WM_CTLCOLOR is enough. The Deskbands I created contains only owner draw controls using GDI+ therefore I do not have the problem you described since I handle the alpha channel.

    Here is an very nice CodeProject article that explains your problem exactly and shows how to solve it:

    http://www.codeproject.com/Articles/18910/Adding-or-Retrofitting-Aero-Glass-into-Legacy-Wind

    If this article does not help you feel free to ask again.

    Thursday, August 2, 2012 5:02 AM

All replies

  • The easiest workaround would be using instead of the color 0x00000000 (COLORREF value) the color 0x00010101. It is almost black and the DWM will not intepret this color to make it transparent.

    If you really want to handle black (RGB value 0,0,0) you have to use GDI+ and also work with the alpha channel that GDI+ supports.

    Wednesday, August 1, 2012 5:16 AM
  • Thanks Bordon.

    Can I  achieve my requirement by overriding WM_CTLCOLOR messages ?

    Wednesday, August 1, 2012 1:40 PM
  • I'm not sure if handling WM_CTLCOLOR is enough. The Deskbands I created contains only owner draw controls using GDI+ therefore I do not have the problem you described since I handle the alpha channel.

    Here is an very nice CodeProject article that explains your problem exactly and shows how to solve it:

    http://www.codeproject.com/Articles/18910/Adding-or-Retrofitting-Aero-Glass-into-Legacy-Wind

    If this article does not help you feel free to ask again.

    Thursday, August 2, 2012 5:02 AM