Alex Rivera | Logout

C# Windows7/Vista style ListView

Asked 2010-12-16T16:27:18.720
9

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: alt text

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

Edit
Report

2 Answers

14

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);
   } 
answered 2010-12-16T16:38:42.107
0

Have you checked the Windows API Code Pack? it has many Win7 style controls. I think it has what you want.

answered 2010-12-16T16:40:48.363

Your Answer