Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What color to use in owner-draw Windows List Control background?

Tags:

c++

windows

mfc

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?

like image 630
Mark Ransom Avatar asked Apr 12 '10 23:04

Mark Ransom


2 Answers

COLOR_INACTIVECAPTION (3), I think.

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

like image 127
MusiGenesis Avatar answered Sep 23 '22 13:09

MusiGenesis


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.

like image 43
BlueRaja - Danny Pflughoeft Avatar answered Sep 23 '22 13:09

BlueRaja - Danny Pflughoeft