Esempio n. 1
0
        private void SaveSettings(bool isCloseApp)
        {
            ApplicationSettings settings = new ApplicationSettings(this.Location);

            settings.HOffset                  = krbTabControl1.TabHOffset;
            settings.SelectedTabPageName      = krbTabControl1.SelectedTab != null ? krbTabControl1.SelectedTab.Name : null;
            settings.IsStretchToParent        = krbTabControl1.HeaderVisibility;
            settings.FirstTabItemColor        = krbTabControl1.TabGradient.ColorStart;
            settings.SecondTabItemColor       = krbTabControl1.TabGradient.ColorEnd;
            settings.SelectedTabItemTextColor = krbTabControl1.TabGradient.TabPageSelectedTextColor;
            settings.Red                 = krbTabControl1.CaptionRandomizer.Red;
            settings.Green               = krbTabControl1.CaptionRandomizer.Green;
            settings.Blue                = krbTabControl1.CaptionRandomizer.Blue;
            settings.Alpha               = krbTabControl1.CaptionRandomizer.Transparency;
            settings.IsDrawHeader        = krbTabControl1.IsDrawHeader;
            settings.IsDrawEdgeBorder    = krbTabControl1.IsDrawEdgeBorder;
            settings.IsCaptionVisible    = krbTabControl1.IsCaptionVisible;
            settings.IsRandomizerEnabled = krbTabControl1.CaptionRandomizer.IsRandomizerEnabled;
            settings.IsDrawTabSeparator  = krbTabControl1.IsDrawTabSeparator;
            settings.BorderStyles        = krbTabControl1.BorderStyle;
            settings.HeaderStyles        = krbTabControl1.HeaderStyle;
            settings.TabPageStyles       = krbTabControl1.TabStyles;
            settings.TabAlingments       = krbTabControl1.Alignments;

            DataSaver.SaveData(settings);
            if (isCloseApp)
            {
                Application.Exit();
            }
        }
Esempio n. 2
0
        private void menuLoadSettings_Click(object sender, EventArgs e)
        {
            ApplicationSettings settings = DataSaver.LoadData();

            if (settings != null)
            {
                this.krbTabControl1.SuspendLayout();
                this.SuspendLayout();

                this.Location = settings.FormLocation;
                // ************ //
                krbTabControl1.TabHOffset = settings.HOffset;
                toolMenuOffset.Text       = krbTabControl1.TabHOffset.ToString();
                // ************ //
                foreach (TabPage tabPage in krbTabControl1.TabPages)
                {
                    if (tabPage.Name.Equals(settings.SelectedTabPageName))
                    {
                        krbTabControl1.SelectedTab = tabPage;
                        break;
                    }
                }
                // ************ //
                krbTabControl1.HeaderVisibility = settings.IsStretchToParent;
                toolMenuStretch.Text            = String.Format("Stretch To Parent: {0}", krbTabControl1.HeaderVisibility ? "ON" : "OFF");
                toolMenuStretch.Checked         = krbTabControl1.HeaderVisibility ? true : false;
                // ************ //
                krbTabControl1.TabGradient.ColorStart = settings.FirstTabItemColor;
                krbTabControl1.TabGradient.ColorEnd   = settings.SecondTabItemColor;
                krbTabControl1.TabGradient.TabPageSelectedTextColor = settings.SelectedTabItemTextColor;
                // ************ //
                krbTabControl1.CaptionRandomizer = new KRBTabControl.KRBTabControl.RandomizerCaption()
                {
                    Red                   = settings.Red,
                    Green                 = settings.Green,
                    Blue                  = settings.Blue,
                    Transparency          = settings.Alpha,
                    IsRandomizerEnabled   = settings.IsRandomizerEnabled,
                    IsTransparencyEnabled = settings.Alpha == 255 ? false : true
                };
                // ************ //
                krbTabControl1.IsDrawHeader = settings.IsDrawHeader;
                toolMenuHeaderDraw.Text     = String.Format("Header Draw: {0}", krbTabControl1.IsDrawHeader ? "ON" : "OFF");
                toolMenuHeaderDraw.Checked  = krbTabControl1.IsDrawHeader ? true : false;
                // ************ //
                krbTabControl1.IsDrawEdgeBorder = settings.IsDrawEdgeBorder;
                toolMenuEdgeBorder.Text         = String.Format("Edge Border Drawing: {0}", krbTabControl1.IsDrawEdgeBorder ? "ON" : "OFF");
                toolMenuEdgeBorder.Checked      = krbTabControl1.IsDrawEdgeBorder ? true : false;
                // ************ //
                krbTabControl1.IsCaptionVisible = settings.IsCaptionVisible;
                toolMenuCaption.Text            = String.Format("Caption Visible: {0}", krbTabControl1.IsCaptionVisible ? "ON" : "OFF");
                toolMenuCaption.Checked         = krbTabControl1.IsCaptionVisible ? true : false;
                // ************ //
                toolMenuColorizer.Text    = String.Format("Caption RGBA Colorizer: {0}", krbTabControl1.CaptionRandomizer.IsRandomizerEnabled ? "ON" : "OFF");
                toolMenuColorizer.Checked = krbTabControl1.CaptionRandomizer.IsRandomizerEnabled ? true : false;
                // ************ //
                krbTabControl1.IsDrawTabSeparator = settings.IsDrawTabSeparator;
                toolMenuSeparator.Text            = String.Format("TabItem Separator: {0}", krbTabControl1.IsDrawTabSeparator ? "ON" : "OFF");
                toolMenuSeparator.Checked         = krbTabControl1.IsDrawTabSeparator ? true : false;
                // ************ //
                krbTabControl1.BorderStyle = settings.BorderStyles;
                switch (krbTabControl1.BorderStyle)
                {
                case KRBTabControl.KRBTabControl.ControlBorderStyle.Dashed:
                    menuBorderDashed.Checked = true;
                    menuBorderDotted.Checked = false;
                    menuBorderSolid.Checked  = false;
                    break;

                case KRBTabControl.KRBTabControl.ControlBorderStyle.Dotted:
                    menuBorderDotted.Checked = true;
                    menuBorderDashed.Checked = false;
                    menuBorderSolid.Checked  = false;
                    break;

                default:
                    menuBorderSolid.Checked  = true;
                    menuBorderDashed.Checked = false;
                    menuBorderDotted.Checked = false;
                    break;
                }
                // ************ //
                krbTabControl1.HeaderStyle = settings.HeaderStyles;
                switch (krbTabControl1.HeaderStyle)
                {
                case KRBTabControl.KRBTabControl.TabHeaderStyle.Texture:
                    menuTexture.Checked = true;
                    menuHatch.Checked   = false;
                    menuSolid.Checked   = false;
                    break;

                case KRBTabControl.KRBTabControl.TabHeaderStyle.Hatch:
                    menuHatch.Checked   = true;
                    menuTexture.Checked = false;
                    menuSolid.Checked   = false;
                    break;

                default:
                    menuSolid.Checked   = true;
                    menuTexture.Checked = false;
                    menuHatch.Checked   = false;
                    break;
                }
                // ************* //
                krbTabControl1.TabStyles = settings.TabPageStyles;
                switch (krbTabControl1.TabStyles)
                {
                case KRBTabControl.KRBTabControl.TabStyle.VS2010:
                    menu2010.Checked     = true;
                    menuOfficeXP.Checked = false;
                    menuKRBStyle.Checked = false;
                    break;

                case KRBTabControl.KRBTabControl.TabStyle.OfficeXP:
                    menuOfficeXP.Checked = true;
                    menu2010.Checked     = false;
                    menuKRBStyle.Checked = false;
                    break;

                default:
                    menuKRBStyle.Checked = true;
                    menu2010.Checked     = false;
                    menuOfficeXP.Checked = false;
                    break;
                }
                // *************** //
                krbTabControl1.Alignments = settings.TabAlingments;
                switch (krbTabControl1.Alignments)
                {
                case KRBTabControl.KRBTabControl.TabAlignments.Top:
                    menuTop.Checked    = true;
                    menuBottom.Checked = false;
                    break;

                default:
                    menuBottom.Checked = true;
                    menuTop.Checked    = false;
                    break;
                }

                this.krbTabControl1.ResumeLayout(false);
                this.ResumeLayout(false);
                this.PerformLayout();
            }
        }