private void loadPaletteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Create a new palette for the importing
            KryptonPalette newPalette = new KryptonPalette();

            // If the user managed to load a palette file
            if (newPalette.Import().Length > 0)
            {
                // Then switch the using the new one
                kryptonPaletteCustom = newPalette;

                if (!toolStripCustom.Checked)
                {
                    // Then use existing method to switch to using the custom palette
                    toolStripCustom_Click(null, EventArgs.Empty);
                }
                else
                {
                    // Use the custom palette
                    kryptonManager.GlobalPalette = kryptonPaletteCustom;
                    UpdateOnPaletteChanged();
                }

                // Change of palette means a change in colors that need
                // applying to the background of the standard controls
                UpdateOnPaletteChanged();
            }
        }
 private void OnImportClick(object sender, EventArgs e)
 {
     if (_palette != null)
     {
         _palette.Import();
         _service.OnComponentChanged(_palette, null, null, null);
     }
 }
Example #3
0
        private void Open()
        {
            if (_dirty)
            {
                // Ask user if the current palette should be saved
                switch (KryptonMessageBox.Show(this, "Save changes to the current palette?", "Palette Changed", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning))
                {
                case DialogResult.Yes:
                    // Use existing save method
                    SavePalette();
                    break;

                case DialogResult.Cancel:
                    // Cancel out entirely
                    return;
                }
            }

            KryptonPalette _palette = new KryptonPalette();

            Cursor = Cursors.WaitCursor;

            Application.DoEvents();

            string fileName = _paletteTheme.Import();

            Cursor = Cursors.Default;

            if (fileName.Length > 0)
            {
                if (_paletteTheme != null)
                {
                    _paletteTheme.PalettePaint -= new EventHandler <PaletteLayoutEventArgs>(OnPalettePaint);
                }

                _paletteTheme = _palette;

                _tmsChrome.Palette = _paletteTheme;

                _ribbonChrome.OverridePalette = _paletteTheme;

                _paletteTheme.PalettePaint += new EventHandler <PaletteLayoutEventArgs>(OnPalettePaint);

                labelGridNormal.SelectedObject = _paletteTheme;

                _fileName = fileName;

                _loaded = true;

                _dirty = false;

                ApplyPalette();

                UpdateTitleBar();
            }

            _mostRecentlyUsedFileManager.AddRecentFile(fileName);
        }
        public void ImportColourScheme()
        {
            try
            {
                _palette = new KryptonPalette();

                _palette.Import();

                _colourSettingsManager.SetBaseColour(_palette.ButtonStyles.ButtonCommon.OverrideDefault.Back.Color1);

                _colourSettingsManager.SetDarkColour(_palette.ButtonStyles.ButtonCluster.StatePressed.Back.Color1);

                _colourSettingsManager.SetMediumColour(_palette.ButtonStyles.ButtonCluster.StateNormal.Back.Color1);

                _colourSettingsManager.SetLightColour(_palette.ButtonStyles.ButtonCommon.StateCheckedPressed.Back.Color2);

                _colourSettingsManager.SetLightestColour(_palette.ButtonStyles.ButtonCommon.StateCheckedPressed.Back.Color1);

                _colourSettingsManager.SetBorderColour(Color.Gray); // Need work

                _colourSettingsManager.SetAlternativeNormalTextColour(_palette.ButtonStyles.ButtonCommon.OverrideDefault.Content.LongText.Color1);

                _colourSettingsManager.SetNormalTextColour(_palette.ButtonStyles.ButtonCommon.StateCheckedNormal.Content.LongText.Color1);

                _colourSettingsManager.SetDisabledTextColour(_palette.ButtonStyles.ButtonCommon.StateDisabled.Content.LongText.Color1);

                _colourSettingsManager.SetDisabledControlColour(_palette.ButtonStyles.ButtonCommon.StateDisabled.Back.Color1);

                _colourSettingsManager.SetLinkNormalColour(_palette.LabelStyles.LabelNormalControl.OverrideNotVisited.LongText.Color1);

                _colourSettingsManager.SetLinkHoverColour(_palette.LabelStyles.LabelNormalControl.OverridePressed.LongText.Color1);

                _colourSettingsManager.SetLinkVisitedColour(_palette.LabelStyles.LabelNormalControl.OverrideVisited.LongText.Color1);



                _colourSettingsManager.SetMenuTextColour(_palette.ToolMenuStatus.Menu.MenuItemText);

                _colourSettingsManager.SetStatusStripTextColour(_palette.ToolMenuStatus.StatusStrip.StatusStripText);

                _colourSettingsManager.SaveAllMergedColourSettings();

                _globalStringSettingsManager.SetBasePaletteMode(_palette.BasePaletteMode.ToString());

                _globalStringSettingsManager.SetFeedbackText("The import was successful.");

                _globalStringSettingsManager.SaveStringSettings();
            }
            catch (Exception exc)
            {
                ExtendedKryptonMessageBox.Show($"Error: { exc.Message }", "_palette Import Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);

                _globalStringSettingsManager.SetFeedbackText("Failed to import colours!");

                _globalStringSettingsManager.SaveStringSettings();
            }
        }
Example #5
0
        /// <summary>
        /// Sets the custom theme.
        /// </summary>
        /// <param name="manager">The manager.</param>
        /// <param name="palette">The palette.</param>
        /// <param name="paletteFileName">Name of the palette file.</param>
        public static void SetCustomTheme(KryptonManager manager, KryptonPalette palette, string paletteFileName)
        {
            PaletteThemeSettingsManager paletteThemeSettingsManager = new PaletteThemeSettingsManager();

            ThemeManager themeManager = new ThemeManager();

            themeManager.SetTheme(PaletteModeManager.Custom, manager);

            palette.Import(paletteFileName);

            paletteThemeSettingsManager.SetCustomThemeFilePath(paletteFileName);
        }
        public void ImportColourScheme()
        {
            try
            {
                _palette = new KryptonPalette();

                _palette.Import();

                _colourSettingsManager.SetBaseColour(_palette.ButtonStyles.ButtonCommon.OverrideDefault.Back.Color1);

                _colourSettingsManager.SetDarkestColour(_palette.ButtonStyles.ButtonCluster.StatePressed.Back.Color1);

                _colourSettingsManager.SetMediumColour(_palette.ButtonStyles.ButtonCluster.StateNormal.Back.Color1);

                _colourSettingsManager.SetLightColour(_palette.ButtonStyles.ButtonCommon.StateCheckedPressed.Back.Color2);

                _colourSettingsManager.SetLightestColour(_palette.ButtonStyles.ButtonCommon.StateCheckedPressed.Back.Color1);

                _colourSettingsManager.SetBorderColour(Color.Gray); // Need work

                _colourSettingsManager.SetAlternativeNormalTextColour(_palette.ButtonStyles.ButtonCommon.OverrideDefault.Content.LongText.Color1);

                _colourSettingsManager.SetNormalTextColour(_palette.ButtonStyles.ButtonCommon.StateCheckedNormal.Content.LongText.Color1);

                _colourSettingsManager.SetDisabledTextColour(_palette.ButtonStyles.ButtonCommon.StateDisabled.Content.LongText.Color1);

                _colourSettingsManager.SetDisabledColour(_palette.ButtonStyles.ButtonCommon.StateDisabled.Back.Color1);

                _colourSettingsManager.SetLinkNormalColour(_palette.LabelStyles.LabelNormalControl.OverrideNotVisited.LongText.Color1);

                _colourSettingsManager.SetLinkHoverColour(_palette.LabelStyles.LabelNormalControl.OverridePressed.LongText.Color1);

                _colourSettingsManager.SetLinkVisitedColour(_palette.LabelStyles.LabelNormalControl.OverrideVisited.LongText.Color1);



                _colourSettingsManager.SetMenuTextColour(_palette.ToolMenuStatus.Menu.MenuItemText);

                _colourSettingsManager.SetStatusTextColour(_palette.ToolMenuStatus.StatusStrip.StatusStripText);

                _colourSettingsManager.SaveColourSettings();
            }
            catch (Exception exc)
            {
                throw;
            }
        }
        private void TryTimer_Tick(object sender, EventArgs e)
        {
            int tryTimeout = 10;

            KryptonPalette palette = new KryptonPalette();

            KryptonManager manager = new KryptonManager();

            while (tryTimeout > 0)
            {
                palette.Import(ktxtCustomPath.Text, false);

                manager.GlobalPaletteMode = PaletteModeManager.Custom;

                manager.GlobalPalette = palette;
            }
        }
Example #8
0
        private void MyOwnRecentPaletteFileGotClicked_Handler(object sender, EventArgs e)
        {
            string fileName = (sender as ToolStripItem).Text;

            if (!File.Exists(fileName))
            {
                if (KryptonMessageBox.Show($"{ fileName } doesn't exist. Remove from recent workspaces?", "File not found", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    _recentlyUsedDocumentsManager.RemoveRecentFile(fileName);
                }
                else
                {
                    return;
                }
            }

            _palette.Import(fileName);
        }
        private void kbtnApply_Click(object sender, EventArgs e)
        {
            KryptonPalette palette = new KryptonPalette();

            KryptonManager manager = new KryptonManager();

            try
            {
                palette.Import(ktxtCustomPath.Text, false);

                manager.GlobalPalette = palette;

                manager.GlobalPaletteMode = PaletteModeManager.Custom;
            }
            catch (Exception exc)
            {
                ExceptionHandler.CaptureException(exc);
            }
        }
        public static KryptonPalette Load(string filename, string paletteName)
        {
            PaletteFilename = filename;
            PaletteName     = paletteName;

            KryptonPalette kryptonPalette = new KryptonPalette();

            IsSystemPalette = true;
            try
            {
                if (File.Exists(filename))
                {
                    if (!string.IsNullOrWhiteSpace(kryptonPalette.Import(filename, true)))
                    {
                        IsSystemPalette = false;
                    }
                }
                else
                {
                    IsSystemPalette = true;
                }
            } catch
            {
                IsSystemPalette = true;
            }

            if (IsSystemPalette)
            {
                if (string.IsNullOrWhiteSpace(paletteName))
                {
                    paletteName = ThemeManager.ReturnPaletteModeAsString(PaletteMode.Office365Blue);
                }
                if (paletteName == ThemeManager.ReturnPaletteModeAsString(PaletteMode.Office2007Black))
                {
                    kryptonPalette.BasePaletteMode = PaletteMode.Office2007Black;
                }
                else if (paletteName == ThemeManager.ReturnPaletteModeAsString(PaletteMode.Office2007Blue))
                {
                    kryptonPalette.BasePaletteMode = PaletteMode.Office2007Blue;
                }
                else if (paletteName == ThemeManager.ReturnPaletteModeAsString(PaletteMode.Office2007Silver))
                {
                    kryptonPalette.BasePaletteMode = PaletteMode.Office2007Silver;
                }
                else if (paletteName == ThemeManager.ReturnPaletteModeAsString(PaletteMode.Office2007White))
                {
                    kryptonPalette.BasePaletteMode = PaletteMode.Office2007White;
                }
                else if (paletteName == ThemeManager.ReturnPaletteModeAsString(PaletteMode.Office2010Black))
                {
                    kryptonPalette.BasePaletteMode = PaletteMode.Office2010Black;
                }
                else if (paletteName == ThemeManager.ReturnPaletteModeAsString(PaletteMode.Office2010Blue))
                {
                    kryptonPalette.BasePaletteMode = PaletteMode.Office2010Blue;
                }
                else if (paletteName == ThemeManager.ReturnPaletteModeAsString(PaletteMode.Office2010Silver))
                {
                    kryptonPalette.BasePaletteMode = PaletteMode.Office2010Silver;
                }
                else if (paletteName == ThemeManager.ReturnPaletteModeAsString(PaletteMode.Office2010White))
                {
                    kryptonPalette.BasePaletteMode = PaletteMode.Office2010White;
                }
                else if (paletteName == ThemeManager.ReturnPaletteModeAsString(PaletteMode.Office2013White))
                {
                    kryptonPalette.BasePaletteMode = PaletteMode.Office2013White;
                }
                else if (paletteName == ThemeManager.ReturnPaletteModeAsString(PaletteMode.Office365Black))
                {
                    kryptonPalette.BasePaletteMode = PaletteMode.Office365Black;
                }
                else if (paletteName == ThemeManager.ReturnPaletteModeAsString(PaletteMode.Office365Blue))
                {
                    kryptonPalette.BasePaletteMode = PaletteMode.Office365Blue;
                }
                else if (paletteName == ThemeManager.ReturnPaletteModeAsString(PaletteMode.Office365Silver))
                {
                    kryptonPalette.BasePaletteMode = PaletteMode.Office365Silver;
                }
                else if (paletteName == ThemeManager.ReturnPaletteModeAsString(PaletteMode.Office365White))
                {
                    kryptonPalette.BasePaletteMode = PaletteMode.Office365White;
                }
                else if (paletteName == ThemeManager.ReturnPaletteModeAsString(PaletteMode.ProfessionalOffice2003))
                {
                    kryptonPalette.BasePaletteMode = PaletteMode.ProfessionalOffice2003;
                }
                else if (paletteName == ThemeManager.ReturnPaletteModeAsString(PaletteMode.ProfessionalSystem))
                {
                    kryptonPalette.BasePaletteMode = PaletteMode.ProfessionalSystem;
                }
                else if (paletteName == ThemeManager.ReturnPaletteModeAsString(PaletteMode.SparkleBlue))
                {
                    kryptonPalette.BasePaletteMode = PaletteMode.SparkleBlue;
                }
                else if (paletteName == ThemeManager.ReturnPaletteModeAsString(PaletteMode.SparkleOrange))
                {
                    kryptonPalette.BasePaletteMode = PaletteMode.SparkleOrange;
                }
                else if (paletteName == ThemeManager.ReturnPaletteModeAsString(PaletteMode.SparklePurple))
                {
                    kryptonPalette.BasePaletteMode = PaletteMode.SparklePurple;
                }
                else
                {
                    throw new NotImplementedException();
                }
            }
            return(kryptonPalette);
        }
Example #11
0
        private void Open()
        {
            // If the current palette has been changed
            if (_dirty)
            {
                // Ask user if the current palette should be saved
                switch (MessageBox.Show(this,
                                        "Save changes to the current palette?",
                                        "Palette Changed",
                                        MessageBoxButtons.YesNoCancel,
                                        MessageBoxIcon.Warning))
                {
                case DialogResult.Yes:
                    // Use existing save method
                    Save();
                    break;

                case DialogResult.Cancel:
                    // Cancel out entirely
                    return;
                }
            }

            // Create a fresh palette instance for loading into
            KryptonPalette palette = new KryptonPalette();

            // Get the name of the file we imported from
            Cursor = Cursors.WaitCursor;
            Application.DoEvents();
            string filename = palette.Import();

            Cursor = Cursors.Default;

            // If the load succeeded
            if (filename.Length > 0)
            {
                // Need to unhook from any existing palette
                if (_palette != null)
                {
                    _palette.PalettePaint -= new EventHandler <PaletteLayoutEventArgs>(OnPalettePaint);
                }

                // Use the new instance instead
                _palette                      = palette;
                _chromeTMS.Palette            = _palette;
                _chromeRibbon.OverridePalette = _palette;

                // We need to know when a change occurs to the palette settings
                _palette.PalettePaint += new EventHandler <PaletteLayoutEventArgs>(OnPalettePaint);

                // Hook up the property grid to the palette
                kpgPaletteProperties.SelectedObject = _palette;

                // Use the loaded filename
                _filename = filename;

                // Reset the state flags
                _loaded = true;
                _dirty  = false;

                // Apply the new palette to the design controls
                ApplyPalette();

                // Define the initial title bar string
                UpdateTitlebar();
            }
        }
Example #12
0
        private void Open()
        {
            tslStatus.Text = "Attempting to inport colours from selected palette. Please wait...";

            // If the current palette has been changed
            if (Dirty)
            {
                // Ask user if the current palette should be saved
                switch (KryptonMessageBox.Show(this,
                                               "Save changes to the current palette?",
                                               "Palette Changed",
                                               MessageBoxButtons.YesNoCancel,
                                               MessageBoxIcon.Warning))
                {
                case DialogResult.Yes:
                    // Use existing save method
                    Save();
                    break;

                case DialogResult.Cancel:
                    // Cancel out entirely
                    return;
                }
            }

            // Create a fresh palette instance for loading into
            KryptonPalette palette = new KryptonPalette();

            // Get the name of the file we imported from
            Cursor = Cursors.WaitCursor;
            Application.DoEvents();
            string filename = palette.Import();

            Cursor = Cursors.Default;

            // If the load succeeded
            if (filename.Length > 0)
            {
                // Need to unhook from any existing palette
                if (Palette != null)
                {
                    Palette.PalettePaint -= new EventHandler <PaletteLayoutEventArgs>(OnPalettePaint);
                }

                // Use the new instance instead
                Palette = palette;

                // We need to know when a change occurs to the palette settings
                Palette.PalettePaint += new EventHandler <PaletteLayoutEventArgs>(OnPalettePaint);

                // Hook up the property grid to the palette
                labelGridNormal.SelectedObject = Palette;

                // Use the loaded filename
                FileName = filename;

                // Reset the state flags
                Loaded = true;
                Dirty  = false;

                // Define the initial title bar string
                UpdateTitlebar();
            }

            PaletteImportManager paletteImportManager = new PaletteImportManager();

            paletteImportManager.ImportColourScheme(palette);

            kchkUpdateColours.Enabled = true;

            kcmbBasePaletteMode.Text = _globalStringSettingsManager.GetBasePaletteMode();

            tslStatus.Text = _globalStringSettingsManager.GetFeedbackText();

            kchkUpdateColours.Checked = true;

            invertColoursToolStripMenuItem.Enabled = true;

            kchkInvertColours.Enabled = true;

            _mostRecentlyUsedFileManager.AddRecentFile(filename);
        }
Example #13
0
 private void kbtnLoadTheme_Click(object sender, EventArgs e)
 {
     _palette.Import();
 }
        public static void ImportPaletteColourScheme()
        {
            GlobalStringSettingsManager globalStringSettingsManager = new GlobalStringSettingsManager();

            try
            {
                KryptonPalette palette = new KryptonPalette();

                palette.Import();

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.ALTERNATIVENORMALTEXTCOLOUR, palette.ButtonStyles.ButtonCommon.OverrideDefault.Content.LongText.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.BASECOLOUR, palette.ButtonStyles.ButtonCommon.OverrideDefault.Back.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.BORDERCOLOUR, Color.Gray);          // Needs work!

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.CUSTOMCOLOURONE, Color.Gray);       // Needs work!

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.CUSTOMCOLOURTWO, Color.Gray);       // Needs work!

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.CUSTOMCOLOURTHREE, Color.Gray);     // Needs work!

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.CUSTOMCOLOURFOUR, Color.Gray);      // Needs work!

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.CUSTOMCOLOURFIVE, Color.Gray);      // Needs work!

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.CUSTOMTEXTCOLOURONE, Color.Gray);   // Needs work!

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.CUSTOMTEXTCOLOURTWO, Color.Gray);   // Needs work!

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.CUSTOMTEXTCOLOURTHREE, Color.Gray); // Needs work!

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.CUSTOMTEXTCOLOURFOUR, Color.Gray);  // Needs work!

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.CUSTOMTEXTCOLOURFIVE, Color.Gray);  // Needs work!

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.DARKESTCOLOUR, palette.ButtonStyles.ButtonCluster.StatePressed.Back.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.DISABLEDCONTROLCOLOUR, palette.ButtonStyles.ButtonCommon.StateDisabled.Back.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.DISABLEDTEXTCOLOUR, palette.ButtonStyles.ButtonCommon.StateDisabled.Content.LongText.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.FOCUSEDTEXTCOLOUR, palette.ButtonStyles.ButtonCommon.OverrideFocus.Content.LongText.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.LIGHTCOLOUR, palette.ButtonStyles.ButtonCommon.StateCheckedPressed.Back.Color2);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.LIGHTESTCOLOUR, palette.ButtonStyles.ButtonCommon.StateCheckedPressed.Back.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.LINKDISABLEDCOLOUR, palette.LabelStyles.LabelNormalControl.StateDisabled.LongText.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.LINKHOVERCOLOUR, palette.LabelStyles.LabelNormalControl.OverridePressed.LongText.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.LINKNORMALCOLOUR, palette.LabelStyles.LabelNormalControl.OverrideNotVisited.LongText.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.LINKVISITEDCOLOUR, palette.LabelStyles.LabelNormalControl.OverrideVisited.LongText.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.MEDIUMCOLOUR, palette.ButtonStyles.ButtonCluster.StateNormal.Back.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.MENUTEXTCOLOUR, palette.ToolMenuStatus.Menu.MenuItemText);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.NORMALTEXTCOLOUR, palette.ButtonStyles.ButtonCommon.StateCommon.Content.LongText.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.PRESSEDTEXTCOLOUR, palette.ButtonStyles.ButtonCommon.StatePressed.Content.LongText.Color1);

                ColourSettingsManagementEngine.SetColourSettingsAsColour(AllAvailableColourTypes.STATUSTEXTCOLOUR, palette.ToolMenuStatus.StatusStrip.StatusStripText);

                ColourSettingsManagementEngine.SaveSettings(SettingTypes.COLOUR);

                globalStringSettingsManager.SetBasePaletteMode(palette.BasePaletteMode.ToString());

                globalStringSettingsManager.SetFeedbackText("The import was successful.");

                ColourSettingsManagementEngine.SaveSettings(SettingTypes.STRING);
            }
            catch (Exception exc)
            {
                KryptonMessageBox.Show($"Error: { exc.Message }", "_palette Import Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);

                globalStringSettingsManager.SetFeedbackText("Failed to import colours!");

                globalStringSettingsManager.SaveStringSettings();
            }
        }
        public static void SetPalette(KryptonForm kryptonForm, KryptonManager kryptonManager, IPalette newKryptonPalette, bool isSystemPalette, bool enableDropShadow)
        {
            KryptonPalette kryptonPalette = new KryptonPalette();

            kryptonPalette.Import(((KryptonPalette)newKryptonPalette).Export(false, true)); //Make a copy
            kryptonManager.GlobalPalette = kryptonPalette;
            kryptonForm.UseDropShadow    = enableDropShadow;
            if (isSystemPalette)
            {
                switch (((KryptonPalette)newKryptonPalette).BasePaletteMode)
                {
                case PaletteMode.Office2007Black:
                case PaletteMode.Office2010Black:
                case PaletteMode.Office365Black:
                    //ColumnHeader - Normal - 0
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCommon.StateCommon.HeaderColumn.Back.Color1    = DataGridViewHandler.ColorBackHeaderNormal(null);
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCommon.StateCommon.HeaderColumn.Content.Color1 = DataGridViewHandler.ColorTextHeaderNormal(null);

                    //ColumnHeader - Warning - 1
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCustom1.StateCommon.HeaderColumn.Back.Color1    = DataGridViewHandler.ColorBackHeaderWarning(null);
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCustom1.StateCommon.HeaderColumn.Content.Color1 = DataGridViewHandler.ColorTextHeaderWarning(null);

                    //ColumnHeader - Error - 2
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCustom2.StateCommon.HeaderColumn.Back.Color1    = DataGridViewHandler.ColorBackCellError(null);
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCustom2.StateCommon.HeaderColumn.Content.Color1 = DataGridViewHandler.ColorTextCellError(null);

                    //ColumnHeader - Image - 3
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCustom3.StateCommon.HeaderColumn.Back.Color1    = DataGridViewHandler.ColorBackCellImage(null);
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCustom3.StateCommon.HeaderColumn.Content.Color1 = DataGridViewHandler.ColorTextCellImage(null);

                    //Cell - Editable - (Normal / Favorite) - 0
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCommon.StateNormal.DataCell.Back.Color1    = DataGridViewHandler.ColorBackCellNormal(null);
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCommon.StateNormal.DataCell.Content.Color1 = DataGridViewHandler.ColorTextCellNormal(null);
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCommon.StateNormal.DataCell.Back.Color2    = DataGridViewHandler.ColorBackCellFavorite(null);
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCommon.StateNormal.DataCell.Content.Color2 = DataGridViewHandler.ColorTextCellFavorite(null);

                    //Cell - ReadOnly - 0 (Normal / Favorite)
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCommon.StateDisabled.DataCell.Back.Color1    = DataGridViewHandler.ColorBackCellReadOnly(null);
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCommon.StateDisabled.DataCell.Content.Color1 = DataGridViewHandler.ColorTextCellReadOnly(null);
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCommon.StateDisabled.DataCell.Back.Color2    = DataGridViewHandler.ColorBackCellFavoriteReadOnly(null);
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCommon.StateDisabled.DataCell.Content.Color2 = DataGridViewHandler.ColorTextCellFavoriteReadOnly(null);

                    //Cell - Warning - 1

                    //Cell - Error - 2
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCustom2.StateNormal.DataCell.Back.Color1    = DataGridViewHandler.ColorBackCellError(null);
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCustom2.StateNormal.DataCell.Content.Color1 = DataGridViewHandler.ColorTextCellError(null);

                    //Cell - RegionFace - 3
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCustom3.StateNormal.DataCell.Back.Color1    = DataGridViewHandler.ColorBackCellImage(null);
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCustom3.StateNormal.DataCell.Content.Color1 = DataGridViewHandler.ColorTextCellImage(null);
                    break;

                case PaletteMode.Office2007Blue:
                case PaletteMode.Office2007Silver:
                case PaletteMode.Office2007White:
                case PaletteMode.Office2010Blue:
                case PaletteMode.Office2010Silver:
                case PaletteMode.Office2010White:
                case PaletteMode.Office2013White:
                case PaletteMode.Office365Blue:
                case PaletteMode.Office365Silver:
                case PaletteMode.Office365White:
                case PaletteMode.ProfessionalOffice2003:
                case PaletteMode.ProfessionalSystem:
                case PaletteMode.SparkleBlue:
                case PaletteMode.SparkleOrange:
                case PaletteMode.SparklePurple:
                    //ColumnHeader - Normal - 0
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCommon.StateCommon.HeaderColumn.Back.Color1    = DataGridViewHandler.ColorBackHeaderNormal(null);
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCommon.StateCommon.HeaderColumn.Content.Color1 = DataGridViewHandler.ColorTextHeaderNormal(null);

                    //ColumnHeader - Warning - 1
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCustom1.StateCommon.HeaderColumn.Back.Color1    = DataGridViewHandler.ColorBackHeaderWarning(null);
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCustom1.StateCommon.HeaderColumn.Content.Color1 = DataGridViewHandler.ColorTextHeaderWarning(null);

                    //ColumnHeader - Error - 2
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCustom2.StateCommon.HeaderColumn.Back.Color1    = DataGridViewHandler.ColorBackCellError(null);
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCustom2.StateCommon.HeaderColumn.Content.Color1 = DataGridViewHandler.ColorTextCellError(null);

                    //ColumnHeader - Image - 3
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCustom3.StateCommon.HeaderColumn.Back.Color1    = DataGridViewHandler.ColorBackCellImage(null);
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCustom3.StateCommon.HeaderColumn.Content.Color1 = DataGridViewHandler.ColorTextCellImage(null);

                    //Cell - Editable - (Normal / Favorite) - 0
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCommon.StateNormal.DataCell.Back.Color1    = DataGridViewHandler.ColorBackCellNormal(null);
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCommon.StateNormal.DataCell.Content.Color1 = DataGridViewHandler.ColorTextCellNormal(null);
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCommon.StateNormal.DataCell.Back.Color2    = DataGridViewHandler.ColorBackCellFavorite(null);
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCommon.StateNormal.DataCell.Content.Color2 = DataGridViewHandler.ColorTextCellFavorite(null);

                    //Cell - ReadOnly - 0 (Normal / Favorite)
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCommon.StateDisabled.DataCell.Back.Color1    = DataGridViewHandler.ColorBackCellReadOnly(null);
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCommon.StateDisabled.DataCell.Content.Color1 = DataGridViewHandler.ColorTextCellReadOnly(null);
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCommon.StateDisabled.DataCell.Back.Color2    = DataGridViewHandler.ColorBackCellFavoriteReadOnly(null);
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCommon.StateDisabled.DataCell.Content.Color2 = DataGridViewHandler.ColorTextCellFavoriteReadOnly(null);

                    //Cell - Warning - 1

                    //Cell - Error - 2
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCustom2.StateNormal.DataCell.Back.Color1    = DataGridViewHandler.ColorBackCellError(null);
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCustom2.StateNormal.DataCell.Content.Color1 = DataGridViewHandler.ColorTextCellError(null);

                    //Cell - RegionFace - 3
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCustom3.StateNormal.DataCell.Back.Color1    = DataGridViewHandler.ColorBackCellImage(null);
                    ((KryptonPalette)kryptonManager.GlobalPalette).GridStyles.GridCustom3.StateNormal.DataCell.Content.Color1 = DataGridViewHandler.ColorTextCellImage(null);
                    break;

                default:
                    throw new NotImplementedException();
                }
            }
        }
Example #16
0
 public static KryptonPalette LoadKryptonPalettePlastic(KryptonPalette NewCustomPalette)
 {
     System.IO.Stream PaletteStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("AC.ExtendedRenderer.Toolkit.Palette.Plastic_v18.xml");
     NewCustomPalette.Import(PaletteStream);
     return(NewCustomPalette);
 }
Example #17
0
        private void loadPaletteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Create a new palette for the importing
            KryptonPalette newPalette = new KryptonPalette();

            // If the user managed to load a palette file
            if (newPalette.Import().Length > 0)
            {
                // Then switch the using the new one
                kryptonPaletteCustom = newPalette;

                if (!toolStripCustom.Checked)
                {
                    // Then use existing method to switch to using the custom palette
                    toolStripCustom_Click(null, EventArgs.Empty);
                }
                else
                {
                    // Use the custom palette
                    kryptonManager.GlobalPalette = kryptonPaletteCustom;
                    UpdateOnPaletteChanged();
                }

                // Change of palette means a change in colors that need
                // applying to the background of the standard controls
                UpdateOnPaletteChanged();
            }
        }