/// <summary> /// Returns true, when visual styles are enabled in this application. /// </summary> private bool VisualStylesEnabled() { // Check if RenderWithVisualStyles property is available in the Application class (New feature in NET 2.0) Type t = typeof(Application); PropertyInfo pi = t.GetProperty("RenderWithVisualStyles"); if (pi == null) { // NET 1.1 OperatingSystem os = Environment.OSVersion; if (os.Platform == PlatformID.Win32NT && (((os.Version.Major == 5) && (os.Version.Minor >= 1)) || (os.Version.Major > 5))) { DLLVersionInfo version = new DLLVersionInfo(); version.cbSize = Marshal.SizeOf(typeof(DLLVersionInfo)); if (DllGetVersion(ref version) == 0) { return((version.dwMajorVersion > 5) && IsThemeActive() && IsAppThemed()); } } return(false); } else { // NET 2.0 return((bool)pi.GetValue(null, null)); } }
//Most methods have been snipped public static bool CanRender() { Type t = typeof(Application); System.Reflection.PropertyInfo pi = t.GetProperty("RenderWithVisualStyles"); if (pi == null) { OperatingSystem os = System.Environment.OSVersion; if (os.Platform == PlatformID.Win32NT && (((os.Version.Major == 5) && (os.Version.Minor >= 1)) || (os.Version.Major > 5))) { DLLVersionInfo version = new DLLVersionInfo(); version.cbSize = Marshal.SizeOf(typeof(DLLVersionInfo)); if (DllGetVersion(ref version) == 0) { return((version.dwMajorVersion > 5) && IsThemeActive() && IsAppThemed()); } } return(false); } else { bool result = (bool)pi.GetValue(null, null); return(result); } }
private bool VisualStylesEnabled() { OperatingSystem oSVersion = Environment.OSVersion; bool flag = (oSVersion.Platform == PlatformID.Win32NT) && (((oSVersion.Version.Major == 5) && (oSVersion.Version.Minor >= 1)) || (oSVersion.Version.Major > 5)); bool flag2 = false; bool flag3 = false; if (flag) { flag2 = OSFeature.Feature.GetVersionPresent(OSFeature.Themes) != null; DLLVersionInfo version = new DLLVersionInfo { cbSize = Marshal.SizeOf(typeof(DLLVersionInfo)) }; DllGetVersion(ref version); flag3 = version.dwMajorVersion >= 6; } return(((flag && flag2) && (flag3 && IsAppThemed())) && IsThemeActive()); }
public static bool CanRender() { Type t = typeof(Application); System.Reflection.PropertyInfo pi = t.GetProperty("RenderWithVisualStyles"); if (pi == null) { OperatingSystem os = System.Environment.OSVersion; if (os.Platform == PlatformID.Win32NT && (((os.Version.Major == 5) && (os.Version.Minor >= 1)) || (os.Version.Major > 5))) { DLLVersionInfo version = new DLLVersionInfo { cbSize = Marshal.SizeOf ( typeof ( DLLVersionInfo ) ) }; if (DllGetVersion(ref version) == 0) { return (version.dwMajorVersion > 5) && IsThemeActive() && IsAppThemed(); } } return false; } bool result = (bool)pi.GetValue(null, null); return result; }
public static extern int DllGetVersion(ref DLLVersionInfo version);
public static extern int DllGetVersion( ref DLLVersionInfo version );
private static extern int DllGetVersion(ref DLLVersionInfo version);
/// <summary> /// Returns true, when visual styles are enabled in this application. /// </summary> private bool VisualStylesEnabled() { // Check if RenderWithVisualStyles property is available in the Application class (New feature in NET 2.0) Type t = typeof(Application); PropertyInfo pi = t.GetProperty("RenderWithVisualStyles"); if (pi == null) { // NET 1.1 OperatingSystem os = Environment.OSVersion; if (os.Platform == PlatformID.Win32NT && (((os.Version.Major == 5) && (os.Version.Minor >= 1)) || (os.Version.Major > 5))) { DLLVersionInfo version = new DLLVersionInfo(); version.cbSize = Marshal.SizeOf(typeof(DLLVersionInfo)); if (DllGetVersion(ref version) == 0) { return (version.dwMajorVersion > 5) && IsThemeActive() && IsAppThemed(); } } return false; } else { // NET 2.0 return (bool)pi.GetValue(null, null); } }
private static extern int DllGetVersion(ref DLLVersionInfo version);