C# Windows7/Vista style ListView

て烟熏妆下的殇ゞ 提交于 2019-12-18 15:48:32

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!