C# Windows7/Vista style ListView
when I create a ListView in details view in VS2008, it creates a rather old looking listview. It doesnt have any of the fancy hover effects and cool blue border that (for example) the file explorer in WinVista and Win7 has. See image for example:
So to summarise, how can I get a ListV开发者_StackOverflow中文版iew in C# VS2008 look like the one in the picture above? (VS2008 listview on the right for comparison)
Thanks
Try calling SetWindowTheme
Like this:
[DllImport("uxtheme.dll", ExactSpelling=true, CharSet=CharSet.Unicode)]
private static extern int SetWindowTheme(IntPtr hwnd, string pszSubAppName, string pszSubIdList);
// The constructor:
public MyForm() {
SetWindowTheme(this.listView1.Handle, "Explorer", null);
}
Have you checked the Windows API Code Pack? it has many Win7 style controls. I think it has what you want.
精彩评论