Changing style of CListCtrl in MFC

1.9k Views Asked by At

I have a ListCtrl in one of the dialog of a mfc application. I want to change the column name style and the button style to look more like win7 themed. this is the old dialog with the listCtrl in right.

Old look

what I want to change the top row of the table and the buttons to something like this ,

New Look

can this be done by changing any style by doing m_ElementListCtrl.SetExtendedStyle(..) ? or chaning some of its properties ?

1

There are 1 best solutions below

0
On

Hi If your app is Unicode(otherwise there is some problems) you need to use Common controls 6.

In your stdafx.h file you probably could see this kind of code , if no , just add it in the end of file, if you change your app to UNICODE you will see controls with new style.

#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32'   name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32'name='Microsoft.Windows.Common-Controls' version='6.0.0.0'processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif

Also check Project Properties -> linker-> Manifest File-> Generate Manifest should be set on Yes (/MANIFEST)