/// <summary>
        /// Paint Gradient
        /// </summary>
        /// <param name="tControl">Painting control</param>
        /// <param name="tGraphics">Graphic object</param>
        /// <param name="tColorTable">NavigataBarColorTable inherited object</param>
        /// <param name="tPaintType">Paint type</param>
        public static void PaintGradientBack(Control tControl, Graphics tGraphics, NavigateBarColorTable tColorTable, PaintType tPaintType)
        {
            if (tControl.ClientRectangle.IsEmpty)
            {
                return;
            }

            #region Color Select

            Color cTopColorBegin    = tColorTable.ButtonNormalBegin;
            Color cTopColorEnd      = tColorTable.ButtonNormalMiddleBegin;
            Color cBottomColorBegin = tColorTable.ButtonNormalMiddleEnd;
            Color cBottomColorEnd   = tColorTable.ButtonNormalEnd;

            switch (tPaintType)
            {
            case PaintType.Selected:
            {
                cTopColorBegin    = tColorTable.ButtonSelectedBegin;
                cTopColorEnd      = tColorTable.ButtonSelectedMiddleBegin;
                cBottomColorBegin = tColorTable.ButtonSelectedMiddleEnd;
                cBottomColorEnd   = tColorTable.ButtonSelectedEnd;

                break;
            }

            case PaintType.MouseOver:
            {
                cTopColorBegin    = tColorTable.ButtonMouseOverBegin;
                cTopColorEnd      = tColorTable.ButtonMouseOverMiddleBegin;
                cBottomColorBegin = tColorTable.ButtonMouseOverMiddleEnd;
                cBottomColorEnd   = tColorTable.ButtonMouseOverEnd;

                break;
            }

            case PaintType.Pressed:
            {
                cTopColorBegin    = tColorTable.ButtonSelectedEnd;
                cTopColorEnd      = tColorTable.ButtonSelectedMiddleBegin;
                cBottomColorBegin = tColorTable.ButtonSelectedMiddleEnd;
                cBottomColorEnd   = tColorTable.ButtonSelectedMiddleEnd;

                break;
            }
            }
            #endregion

            NavigateBarHelper.PaintGradientControl(tControl, tGraphics, cTopColorBegin, cTopColorEnd, cBottomColorBegin, cBottomColorEnd, tColorTable.PaintAngle, tColorTable.PaintRatio);
        }
        public static NavigateBarColorTable ImportColorsFromProfColorTable(ProfessionalColorTable tColorTable)
        {
            NavigateBarColorTable nvColorTable = new NavigateBarColorTable();

            // Custom
            nvColorTable.TextColor         = SystemColors.ControlText;
            nvColorTable.SelectedTextColor = SystemColors.ControlText;
            nvColorTable.BorderColor       = tColorTable.ButtonSelectedHighlightBorder;

            // Caption
            nvColorTable.CaptionTextColor = SystemColors.MenuText;
            nvColorTable.CaptionBegin     = tColorTable.ToolStripGradientBegin;
            nvColorTable.CaptionEnd       = tColorTable.ToolStripGradientEnd;
            nvColorTable.CaptionDescBegin = tColorTable.ToolStripGradientBegin;
            nvColorTable.CaptionDescEnd   = tColorTable.ToolStripGradientEnd;

            // Separator
            nvColorTable.SeparatorDark  = tColorTable.SeparatorDark;
            nvColorTable.SeparatorLight = tColorTable.SeparatorLight;

            // Button Normal
            nvColorTable.ButtonNormalBegin       = tColorTable.ToolStripGradientBegin;
            nvColorTable.ButtonNormalMiddleBegin = tColorTable.ToolStripGradientMiddle;
            nvColorTable.ButtonNormalMiddleEnd   = tColorTable.ToolStripGradientMiddle;
            nvColorTable.ButtonNormalEnd         = tColorTable.ToolStripGradientEnd;

            // Button Selected
            nvColorTable.ButtonSelectedBegin       = tColorTable.ButtonPressedGradientBegin;
            nvColorTable.ButtonSelectedMiddleBegin = tColorTable.ButtonPressedGradientMiddle;
            nvColorTable.ButtonSelectedMiddleEnd   = tColorTable.ButtonPressedGradientMiddle;
            nvColorTable.ButtonSelectedEnd         = tColorTable.ButtonPressedGradientEnd;

            // Button Mouse Over
            nvColorTable.ButtonMouseOverBegin       = tColorTable.ButtonSelectedGradientBegin;
            nvColorTable.ButtonMouseOverMiddleBegin = tColorTable.ButtonSelectedGradientMiddle;
            nvColorTable.ButtonMouseOverMiddleEnd   = tColorTable.ButtonSelectedGradientMiddle;
            nvColorTable.ButtonMouseOverEnd         = tColorTable.ButtonSelectedGradientEnd;

            // Menu
            nvColorTable.MenuBackColor = tColorTable.ToolStripDropDownBackground;

            return(nvColorTable);
        }
        /// <summary>
        /// Get color table for Windows theme( only XP )
        /// </summary>
        /// <returns></returns>
        public static NavigateBarColorTable GetColorTableForWindowsTheme()
        {
            NavigateBarColorTable themeColorTable = NavigateBarColorTable.SystemColor;

            // XP

            if ((Environment.OSVersion.Platform == PlatformID.Win32NT) && Environment.OSVersion.Version.CompareTo(new Version(5, 1, 0, 0)) != 0)
            {
                return(themeColorTable);
            }

            RegistryKey themeKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\ThemeManager");

            if (themeKey == null)
            {
                return(themeColorTable);
            }

            if (!themeKey.GetValue("ThemeActive").ToString().Equals("1"))
            {
                themeColorTable = NavigateBarColorTable.SystemColor;
            }

            if (themeKey.GetValue("ColorName").ToString().Equals("NormalColor"))
            {
                themeColorTable = NavigateBarColorTable.Office2003Blue;
            }

            if (themeKey.GetValue("ColorName").ToString().Equals("Metallic"))
            {
                themeColorTable = NavigateBarColorTable.Office2003Silver;
            }

            if (themeKey.GetValue("ColorName").ToString().Equals("HomeStead"))
            {
                themeColorTable = NavigateBarColorTable.Office2003Olive;
            }

            return(themeColorTable);
        }
Esempio n. 4
0
 public NavigateBarRenderer(NavigateBarColorTable tColorTable)
 {
     colorTable = tColorTable;
 }