【★★技巧三★★】使選擇項顯示為圓角矩形的樣式(就像資源管理器那樣)
效果:


方法:
在stdafx.h中添加:(如果沒有的話也可以在對話框所在的cpp文件頭部添加)
#include <Uxtheme.h>
在項目主cpp文件中添加:(這個也可以加到其他cpp文件中)
#pragma comment(lib, "UxTheme.lib")
在對話框初始化部分執行:
SetWindowTheme(hListView, TEXT("Explorer"), NULL);
【MSDN參考資料】
SetWindowTheme函數用法:
https://msdn.microsoft.com/en-us/library/windows/desktop/bb759827%28v=vs.85%29.aspx
關於List-View控制項:
https://msdn.microsoft.com/en-us/library/windows/desktop/bb774735%28v=vs.85%29.aspx#Extended_ListView_Styles
這張網頁中的這句話是重點:
The visual styles for the control have been set to the "Explorer" theme by using SetWindowTheme.