private static IntPtr OpenTheme(Control hostControl) { IntPtr hTheme; IntPtr hModule = SafeNativeMethods.LoadLibraryW("uxtheme.dll"); if (hModule == IntPtr.Zero) { hTheme = IntPtr.Zero; } else { hTheme = SafeNativeMethods.OpenThemeData(hostControl.Handle, "Button"); SafeNativeMethods.FreeLibrary(hModule); } GC.KeepAlive(hostControl); return(hTheme); }