<p>I'm trying to find a simple way to change the colour of the text and background in <code>listview</code> and <code>treeview</code> controls in WTL or plain Win32 code.</p>

<p>I really don't want to have to implement full owner drawing for these controls, simply change the colours used.</p>

<p>I want to make sure that the images are still drawn with proper transparency.</p>

<p>Any suggestions?</p>

[{'answer_id': 45578, 'author': 'Ferruccio', 'author_id': 4086, 'author_profile': 'https://Stackoverflow.com/users/4086', 'pm_score': 0, 'selected': False, 'text': "<p>It's been a while since I've use the win32 API directly, but I believe that if you handle the WM_ERASEBACKGROUND message for your control, you can use FillRect() in your handler to paint the background using whatever color you like.</p>\n"}, {'answer_id': 45587, 'author': 'ChrisN', 'author_id': 3853, 'author_profile': 'https://Stackoverflow.com/users/3853', 'pm_score': 3, 'selected': True, 'text': '<p>Have a look at the following macros:</p>\n\n<p><a href="http://msdn.microsoft.com/en-us/library/bb775063%28VS.85%29.aspx" rel="nofollow noreferrer">ListView_SetBkColor</a><br>\n<a href="http://msdn.microsoft.com/en-us/library/bb775116%28VS.85%29.aspx&gt;" rel="nofollow noreferrer">ListView_SetTextColor</a>  </p>\n\n<p><a href="http://msdn.microsoft.com/en-us/library/bb760036%28VS.85%29.aspx" rel="nofollow noreferrer">TreeView_SetBkColor</a><br>\n<a href="http://msdn.microsoft.com/en-us/library/bb760131%28VS.85%29.aspx" rel="nofollow noreferrer">TreeView_SetTextColor</a></p>\n'}, {'answer_id': 49257, 'author': 'macbirdie', 'author_id': 5049, 'author_profile': 'https://Stackoverflow.com/users/5049', 'pm_score': 2, 'selected': False, 'text': '<p>There are also appropriate methods of the <code>CListViewCtrl</code> and <code>CTreeViewCtrl</code> wrapper classes:</p>\n\n<ul>\n<li>GetBkColor</li>\n<li>SetBkColor</li>\n</ul>\n'}, {'answer_id': 49318, 'author': 'Alan', 'author_id': 2958, 'author_profile': 'https://Stackoverflow.com/users/2958', 'pm_score': 2, 'selected': False, 'text': '<p>You may also want to take a look at WTL\'s CCustomDraw::OnItemPrePaint (that\'s if you need to control the drawing of individual items)</p>\n\n<p>A good article that describes this process is <a href="http://www.codeproject.com/KB/wtl/WTL_TreeCtrl.aspx" rel="nofollow noreferrer">here</a></p>\n'}]
['https://Stackoverflow.com/questions/45528', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4591/']