private void tabControl_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (ExternalColorEditorInformationProvider != null)
            {
                ExternalColorEditorInformationProvider.SavePerUserPerWorkstationValue(
                    StoreID + @".TabControl.SelectedIndex",
                    tabControl.SelectedIndex.ToString());
            }

            if (NeedUpdateUI != null)
            {
                NeedUpdateUI(this, EventArgs.Empty);
            }
        }
 /// <summary>
 /// Handles the FormClosing event of the <see cref="ColorEditorForm"/> control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.Windows.Forms.FormClosingEventArgs"/>
 /// instance containing the event data.</param>
 private void colorEditorForm_FormClosing(
     object sender,
     FormClosingEventArgs e)
 {
     if (ExternalColorEditorInformationProvider != null)
     {
         ExternalColorEditorInformationProvider.SavePerUserPerWorkstationValue(
             StoreID + @".Width",
             Width.ToString());
         ExternalColorEditorInformationProvider.SavePerUserPerWorkstationValue(
             StoreID + @".Height",
             Height.ToString());
     }
 }
        /// <summary>
        /// Handles the Load event of the <see cref="ColorEditorUserControl"/> control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void colorEditorUserControl_Load(
            object sender,
            EventArgs e)
        {
            if (ExternalColorEditorInformationProvider != null && !_tabSet)
            {
                tabControl.SelectedIndex = Convert.ToInt32(
                    ExternalColorEditorInformationProvider.RestorePerUserPerWorkstationValue(
                        StoreID + @".TabControl.SelectedIndex",
                        tabControl.SelectedIndex.ToString()));
            }

            if (!allowColorSchemes)
            {
                tabControl.TabPages.Remove(schemeColorsTabPage);
            }
        }
        /// <summary>
        /// Handles the Load event of the <see cref="ColorEditorForm"/> control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance
        /// containing the event data.</param>
        private void colorEditorForm_Load(object sender, EventArgs e)
        {
            if (ExternalColorEditorInformationProvider != null)
            {
                Width = Convert.ToInt32(
                    ExternalColorEditorInformationProvider.RestorePerUserPerWorkstationValue(
                        StoreID + @".Width",
                        Width.ToString()));
                Height = Convert.ToInt32(
                    ExternalColorEditorInformationProvider.RestorePerUserPerWorkstationValue(
                        StoreID + @".Height",
                        Height.ToString()));
            }
            CenterToParent();

            buttonNoColor.Visible =
                ExternalColorEditorInformationProvider == null ||
                ExternalColorEditorInformationProvider.AllowNoColorSelectable;
        }
        /// <summary>
        /// Tries to set correct tab page.
        /// </summary>
        private void tryToSetCorrectTabPage(
            Color color)
        {
            TabPage tabPage = null;

            if (color == Color.Empty)
            {
                color = Color.Transparent;
            }

            // http://bugs.zeta-sw.com/view.php?id=2018
            if (color == Color.Transparent)
            {
                if (webColorEditorControl.ContainsColor(color))
                {
                    tabPage = webColorsTabPage;
                }
            }
            else
            {
                var lookupOrder = new List <ColorLookupElement>(_defaultLookupOrder);

                if (ExternalColorEditorInformationProvider != null)
                {
                    ExternalColorEditorInformationProvider.AdjustColorSettingLookupOrder(
                        lookupOrder);

                    // Add again to be safe if the call should have removed some.
                    lookupOrder.AddRange(_defaultLookupOrder);
                }

                // --

                foreach (var element in lookupOrder)
                {
                    switch (element)
                    {
                    case ColorLookupElement.BrowserSafeColors:
                        if (browserSafeColorEditorControl.ContainsColor(color))
                        {
                            tabPage = browserSafeColorsTabPage;
                        }
                        break;

                    default:
                        tabPage = customColorsTabPage;
                        break;

                    case ColorLookupElement.SchemeColors:
                        if (allowColorSchemes &&
                            schemesColorEditorControl.ContainsColor(color))
                        {
                            tabPage = schemeColorsTabPage;
                        }
                        break;

                    case ColorLookupElement.SystemColors:
                        if (systemColorEditorControl.ContainsColor(color))
                        {
                            tabPage = systemColorsTabPage;
                        }
                        break;

                    case ColorLookupElement.WebColors:
                        if (webColorEditorControl.ContainsColor(color))
                        {
                            tabPage = webColorsTabPage;
                        }
                        break;
                    }

                    if (tabPage != null)
                    {
                        break;
                    }
                }
            }

            if (tabPage == null)
            {
                tabPage = customColorsTabPage;
            }


            tabControl.SelectedTab = tabPage;
            _tabSet = true;
        }