Explorer theme for ListView control
[DllImport("uxtheme.dll", CharSet = CharSet.Unicode)]
public extern static int SetWindowTheme(IntPtr hWnd, string pszSubAppName, string pszSubIdList);
 
//overwrite control's OnHandleCreated method
protected override void OnHandleCreated(EventArgs e)
{
    base.OnHandleCreated(e);
    if (Environment.OSVersion.Platform == PlatformID.Win32NT && Environment.OSVersion.Version.Major >= 6)
    {
        SetWindowTheme(this.Handle, "explorer", null);
    }
}
Categories: C# Tags: , , ,
%d bloggers like this: