Пример #1
0
        public void DGVLoadColumnLayout(DataGridView dgv, string root)
        {
            if (SQLiteConnectionUser.keyExists(root + "1"))        // if stored values, set back to what they were..
            {
                for (int i = 0; i < dgv.Columns.Count; i++)
                {
                    string k = root + (i + 1).ToString();
                    int    w = SQLiteDBClass.GetSettingInt(k, -1);
                    if (w >= 10)        // in case something is up (min 10 pixels)
                    {
                        dgv.Columns[i].Width = w;
                    }
                    //System.Diagnostics.Debug.WriteLine("Load {0} {1} {2} {3}", Name, k, w, dgv.Columns[i].Width);
                }

                int hwidth = SQLiteConnectionUser.GetSettingInt(root + "HW", 0);
                if (hwidth > 0)
                {
                    dgv.RowHeadersWidth = hwidth;
                }
                else
                {
                    using (Graphics g = dgv.CreateGraphics())
                    {
                        SizeF sz = g.MeasureString("999999", discoveryform.theme.GetFont);
                        dgv.RowHeadersWidth = (int)(sz.Width + 6);        // size it to the text, need a little more for rounding
                    }
                }
            }
        }
 public void DGVLoadColumnLayout(DataGridView dgv, string root)
 {
     if (SQLiteConnectionUser.keyExists(root + "1"))        // if stored values, set back to what they were..
     {
         for (int i = 0; i < dgv.Columns.Count; i++)
         {
             string k = root + (i + 1).ToString();
             int    w = SQLiteDBClass.GetSettingInt(k, -1);
             if (w >= 10)        // in case something is up (min 10 pixels)
             {
                 dgv.Columns[i].Width = w;
             }
             //System.Diagnostics.Debug.WriteLine("Load {0} {1} {2} {3}", Name, k, w, dgv.Columns[i].Width);
         }
     }
 }
Пример #3
0
        /// <summary>
        ///
        /// </summary>
        /// <returns>true if ok.  False  Means missing colors in theme. </returns>
        public bool RestoreSettings()
        {
            bool ok = true;

            Console.WriteLine("Theme ID " + Settings.ThemeID);

            int themeidstored = SQLiteDBClass.GetSettingInt("ThemeID", -1);

            if (themeidstored != -1 && themeidstored != Settings.ThemeID)
            {
                //DialogResult res = ExtendedControls.MessageBoxTheme.Show("The theme stored has missing colors or other missing information" + Environment.NewLine +
                //      "that this new version of EDDiscovery needs." + Environment.NewLine + Environment.NewLine +
                //      "Choose OK to use the stored theme, and then correct the missing colors or other information manually using the Theme Editor in Settings" + Environment.NewLine + Environment.NewLine +
                //      "Choose Cancel to go back to windows default, then pick a new standard theme.", "ED Discovery Theme Warning!" , MessageBoxButtons.OKCancel);

                //if (res == DialogResult.Cancel)     // if cancel, we abort,
                //    return;
                ok = false;
            }

            if (SQLiteConnectionUser.keyExists("ThemeNameOf"))           // (keep previous check) if there.. get the others with a good default in case the db is screwed.
            {
                currentsettings.name               = SQLiteDBClass.GetSettingString("ThemeNameOf", "Custom");
                currentsettings.windowsframe       = SQLiteDBClass.GetSettingBool("ThemeWindowsFrame", true);
                currentsettings.formopacity        = SQLiteDBClass.GetSettingDouble("ThemeFormOpacity", 100);
                currentsettings.fontname           = SQLiteDBClass.GetSettingString("ThemeFont", defaultfont);
                currentsettings.fontsize           = (float)SQLiteDBClass.GetSettingDouble("ThemeFontSize", defaultfontsize);
                currentsettings.buttonstyle        = SQLiteDBClass.GetSettingString("ButtonStyle", buttonstyle_system);
                currentsettings.textboxborderstyle = SQLiteDBClass.GetSettingString("TextBoxBorderStyle", textboxborderstyle_fixed3D);

                foreach (Settings.CI ck in themelist[0].colors.Keys)        // use themelist to find the key names, as we modify currentsettings as we go and that would cause an exception
                {
                    int   d = themelist[0].colors[ck].ToArgb();             // use windows default colors.
                    Color c = Color.FromArgb(SQLiteDBClass.GetSettingInt("ThemeColor" + ck.ToString(), d));
                    currentsettings.colors[ck] = c;
                }
            }
            return(ok);
        }