How to set the style of ListView to Windows Explorer style in C#


The SetWindowTheme function is used to set the theme of a window

This function can be imported by adding the code below into your class


[System.Runtime.InteropServices.DllImport("uxtheme.dll",ExactSpelling=true, CharSet=System.Runtime.InteropServices .CharSet.Unicode)]
public static extern IntPtr SetWindowTheme(IntPtr hwnd ,string styleof,string subclass);



To set the theme of a window just specify the theme name and the window handle

For example to set the style of a ListView to Windows Explorer style, The code will be like below




SetWindowTheme(listView1.Handle,"explorer","");


Comments

Post a Comment