コード例 #1
0
        private void RestoreDefaults()
        {
            // If users have customized the colors for the 'Default' or 'Debug'
            // schemes, use those customizations. Otherwise, add preset default
            // values to accommodate accidental deletion or intentional reset.

            string defaultKey = "Default";

            if (!ColorSchemes.ContainsKey(defaultKey) || ColorSchemes[defaultKey] == null)
            {
                // Vanity, to be sure, but a pleasant shade nonetheless.
                var tensLogoPurple = new Color(0.4f, 0.3607843f, 0.7960784f, 1.0f);

                ColorSchemes[defaultKey] = new Dictionary <string, Color>
                {
                    { "3D Wireframe", tensLogoPurple },
                    { "3D Flat", tensLogoPurple },
                    { "3D Textured", tensLogoPurple }
                };
            }

            string neutralKey = "Neutral";

            if (!ColorSchemes.ContainsKey(neutralKey) || ColorSchemes[neutralKey] == null)
            {
                var gray = new Color(0.5f, 0.5f, 0.5f, 1.0f);

                ColorSchemes[neutralKey] = new Dictionary <string, Color>
                {
                    { "3D Wireframe", gray },
                    { "3D Flat", gray },
                    { "3D Textured", gray }
                };
            }

            string debugKey = "Debug";

            if (!ColorSchemes.ContainsKey(debugKey) || ColorSchemes[debugKey] == null)
            {
                ColorSchemes[debugKey] = new Dictionary <string, Color>
                {
                    { "3D Wireframe", new Color(1.0f, 0.0f, 0.0f, 1.0f) },
                    { "3D Flat", new Color(0.0f, 1.0f, 0.0f, 1.0f) },
                    { "3D Textured", new Color(0.0f, 0.0f, 1.0f, 1.0f) }
                };
            }

            if (String.IsNullOrEmpty(CurrentColorScheme))
            {
                CurrentColorScheme = "Default";
            }
        }
コード例 #2
0
 public ColorPair GetColorPair(string key)
 {
     if (ColorSchemes.ContainsKey(key))
     {
         return(ColorSchemes[key]);
     }
     else if (Overflow != null)
     {
         return(Overflow.GetColorPair(key));
     }
     else
     {
         throw new KeyNotFoundException("Cannot find ColorPair for that key.");
     }
 }
コード例 #3
0
        public void ApplyColors()
        {
            if (!ColorSchemes.ContainsKey(ColorSchemeID))
            {
                return;
            }

            ApplyWindowStyle();
            ApplyMenuStyle();
            ApplyMessageControlStyle();
            ApplyTextBoxStyle();
            ApplyCheckBoxStyle();
            ApplyControlStyle();
            ApplyButtonStyle();
            ApplyScrollbarStyle();
            ApplyFontStyle();
        }