Ejemplo n.º 1
0
        /// <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));
            }
        }
Ejemplo n.º 2
0
        //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);
            }
        }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 5
0
 public static extern int DllGetVersion(ref DLLVersionInfo version);
Ejemplo n.º 6
0
 public static extern int DllGetVersion( ref DLLVersionInfo version );
Ejemplo n.º 7
0
 private static extern int DllGetVersion(ref DLLVersionInfo version);
Ejemplo n.º 8
0
        /// <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);
            }
        }
Ejemplo n.º 9
0
 private static extern int DllGetVersion(ref DLLVersionInfo version);