/// <summary> /// Save Width of Each Column in RadGrid to SQLite Setting to Restore Later /// </summary> /// <param name="RadGrid"></param> /// <param name="GridName"></param> public void Save_RadGridColumnWidth(RadGridView RadGrid, string GridName = "RadGrid") { string Widths = ""; int i = 0; foreach (GridViewColumn column in RadGrid.Columns) { if (column is GridViewDataColumn) { GridViewDataColumn col = column as GridViewDataColumn; int Width = col.Width; if (Widths == "") { Widths = col.Name + "|" + Width; } else { Widths = Widths + "\n" + col.Name + "|" + Width; } } i++; } sqlite.Setting(GridName + "_Widths", Widths); }
/// <summary>Loads last selected tab # when starting app (from Settings.sqlite table)</summary> /// <param name="tc">TabControl Name</param> public void Load_Last_Tab(TabControl tc) { _Database.SQLite sqlite = new _Database.SQLite(); _AHK ahk = new _AHK(); string LastTabIndex = sqlite.Setting(tc.Name + "_LastTab"); // read same setting value again, this time for the option field, convert to bool response bool LoadLastTab = ahk.ToBool(sqlite.Setting_Value(tc.Name + "_LastTab", ahk.AppDir() + "\\Settings.sqlite", "Settings", "", true)); // check user setting to see if this option is enabled if (LoadLastTab) // if option enabled, read the last index position and select that tab { int lTab = ahk.ToInt(LastTabIndex); try { tc.SelectedIndex = lTab; } catch { } } }