开发者

C# Windows7/Vista style ListView

开发者 https://www.devze.com 2023-01-31 11:44 出处:网络
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

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:

C# Windows7/Vista style ListView

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号