Ejemplo n.º 1
0
        private void CloseTheme()
        {
            // Must close down theme handle
            if (IsControlThemed)
            {
                // Close down the Win32 handle
                Uxtheme.CloseThemeData(_hTheme);

                // No longer have a valid theme handle
                _hTheme = IntPtr.Zero;

                // Raises event
                OnThemeClosed();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static Color GetThemeBorderColor(Color substituteColor)
        {
            Int32 color = 0;

            // UxTheme is only supported on Windows XP and Later
            if (Environment.OSVersion.Version.Major >= 5 &&
                Environment.OSVersion.Version.Minor >= 1)
            {
                IntPtr hTheme = Uxtheme.OpenThemeData(IntPtr.Zero, "Edit");
                if (hTheme != IntPtr.Zero)
                {
                    Uxtheme.GetThemeColor(hTheme, Uxtheme.EP.EDITTEXT, Uxtheme.ETS.NORMAL, Uxtheme.TMT.BORDERCOLOR, out color);
                    Uxtheme.CloseThemeData(hTheme);
                }
            }
            return(color == 0 ? substituteColor : ColorTranslator.FromWin32(color));
        }