问题
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 ListView in C# VS2008 look like the one in the picture above? (VS2008 listview on the right for comparison)
Thanks
回答1:
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);
}
回答2:
Have you checked the Windows API Code Pack? it has many Win7 style controls. I think it has what you want.
来源:https://stackoverflow.com/questions/4462973/c-sharp-windows7-vista-style-listview