tags:

views:

162

answers:

2

I have an owner-drawn list control in my Windows program. I use CListCtrl::GetBkColor to get the background color, and for a selected item I use GetSysColor(COLOR_HIGHLIGHT). This matches what Windows uses for non owner drawn list controls, except for the case where the control doesn't have focus - then the background is replaced with gray.

Does Windows use one of the GetSysColor constants for the selected but unfocused background? If so, which one?

+1  A: 

Ah, ok. With a bit of fiddling, I've determined that it uses the SystemColors.Control color in .Net, which is the equivalent of the C++ COLOR_3DFACE

COLOR_BTNFACE, COLOR_MENU, and COLOR_MENUBAR all also represent the same color on a default install of Windows.

BlueRaja - Danny Pflughoeft
A `ListView` behaves like this, with `View` set to `Details` and `HideSelection` set to `false`.
MusiGenesis
@MusiGenesis, thanks for filling in the details - you're exactly right.
Mark Ransom
COLOR_3DFACE and COLOR_BTNFACE are exactly the same (they both map to the value 15). The others, while they might be the same color initially they are separate values and can be changed independently. Thus the reason for me asking the question.
Mark Ransom
+2  A: 

COLOR_INACTIVECAPTION (3), I think.

Update: Nope, it looks like it's just COLOR_BTNFACE (15).

MusiGenesis
And the text should be COLOR_BTNTEXT. Thanks much!
Mark Ransom