コード例 #1
0
        public override Office2007ButtonItemColorTable GetColorTable(ButtonItem button, eButtonContainer buttonCont)
        {
            Office2007ColorTable colorTable = this.ColorTable;
            Office2007ButtonItemColorTable buttonColorTable = null;

            if (button.CustomColorName != "")
                buttonColorTable = colorTable.ApplicationButtonColors[button.CustomColorName];

            if (buttonColorTable == null)
                buttonColorTable = colorTable.ApplicationButtonColors[button.GetColorTableName()];

            if (buttonColorTable == null && colorTable.ApplicationButtonColors.Count > 0)
                buttonColorTable = colorTable.ApplicationButtonColors[0];

            if (buttonColorTable == null) // Return fall-back color table
                buttonColorTable = Office2010ColorTable.GetFallBackAppButtonColorTable();

            return buttonColorTable;
        }
コード例 #2
0
        public override Office2007ButtonItemColorTable GetColorTable(ButtonItem button, eButtonContainer buttonCont)
        {
            Office2007ColorTable colorTable = this.ColorTable;
            Office2007ButtonItemColorTable buttonColorTable = null;

            if (button.CustomColorName != "")
                buttonColorTable = colorTable.ApplicationButtonColors[button.CustomColorName];

            if (buttonColorTable == null)
                buttonColorTable = colorTable.ApplicationButtonColors[button.GetColorTableName()];

            if (buttonColorTable == null && colorTable.ApplicationButtonColors.Count > 0)
                buttonColorTable = colorTable.ApplicationButtonColors[0];

            if (buttonColorTable == null) // Return fall back static table
                buttonColorTable = DevComponents.DotNetBar.Metro.ColorTables.MetroOfficeColorTableInitializer.GetAppFallBackColorTable();

            return buttonColorTable;
        }
コード例 #3
0
        public virtual Office2007ButtonItemColorTable GetColorTable(ButtonItem button, eButtonContainer buttonCont)
        {
            Office2007ColorTable colorTable = this.ColorTable;
            Office2007ButtonItemColorTable buttonColorTable = null;
            if (buttonCont == eButtonContainer.StatusBar)
            {
                object st = null;
                if (colorTable.ContextualTables.TryGetValue(Office2007ColorTable.GetContextualKey(ButtonColorTableType, "StatusBar"), out st))
                    return (Office2007ButtonItemColorTable)st;
            }
            if (buttonCont == eButtonContainer.RibbonBar && colorTable.RibbonButtonItemColors.Count > 0)
            {
                if (button.CustomColorName != "")
                    buttonColorTable = colorTable.RibbonButtonItemColors[button.CustomColorName];

                if (buttonColorTable == null)
                    buttonColorTable = colorTable.RibbonButtonItemColors[button.GetColorTableName()];

                if (buttonColorTable != null)
                    return buttonColorTable;
            }
            else if ((buttonCont == eButtonContainer.MenuBar || buttonCont == eButtonContainer.StatusBar) && colorTable.MenuButtonItemColors.Count > 0)
            {
                if (button.CustomColorName != "")
                    buttonColorTable = colorTable.MenuButtonItemColors[button.CustomColorName];

                if (buttonColorTable == null)
                    buttonColorTable = colorTable.MenuButtonItemColors[button.GetColorTableName()];

                if (buttonColorTable != null)
                    return buttonColorTable;
            }
            else if (buttonCont == eButtonContainer.Backstage && colorTable.BackstageButtonItemColors.Count > 0)
            {
                if (button.CustomColorName != "")
                    buttonColorTable = colorTable.BackstageButtonItemColors[button.CustomColorName];

                if (buttonColorTable == null)
                    buttonColorTable = colorTable.BackstageButtonItemColors[button.GetColorTableName()];

                if (buttonColorTable != null)
                    return buttonColorTable;
            }
            else if (buttonCont == eButtonContainer.NavigationPane && colorTable.NavigationPaneButtonItemColors.Count > 0)
            {
                if (button.CustomColorName != "")
                    buttonColorTable = colorTable.NavigationPaneButtonItemColors[button.CustomColorName];

                if (buttonColorTable == null)
                    buttonColorTable = colorTable.NavigationPaneButtonItemColors[button.GetColorTableName()];

                if (buttonColorTable != null)
                    return buttonColorTable;
            }

            if (button.CustomColorName != "")
                buttonColorTable = colorTable.ButtonItemColors[button.CustomColorName];

            try
            {
                if (buttonColorTable == null)
                    buttonColorTable = colorTable.ButtonItemColors[button.GetColorTableName()];

                if (buttonColorTable == null)
                    return colorTable.ButtonItemColors[0];
            }
            catch
            {
                buttonColorTable = Office2007ColorTable.GetFallBackButtonItemColorTable();
            }
            return buttonColorTable;
        }