private void moveDownButton_Click(object sender, EventArgs e) { if (this.dataGridView1.SelectedRows.Count == 1) { DataGridViewRow row = this.dataGridView1.SelectedRows[0]; int rowIndex = row.Index; //Can't move tab down and can't go lower than the last position if (rowIndex != this.dataGridView1.Rows.Count - 1 && rowIndex != 0) { this.dataGridView1.Rows.RemoveAt(rowIndex); this.dataGridView1.Rows.Insert(rowIndex + 1, row); for (int i = 0; i < this.dataGridView1.Rows.Count; i++) { this.dataGridView1.Rows[i].Selected = false; } this.dataGridView1.Rows[rowIndex + 1].Selected = true; //possition in list will be 1 less than index due to the first row in the data grid view being the tab KbBimstoreToolbar toolBar = KbBimstoreApp.MainTab.ToolBars[rowIndex - 1]; KbBimstoreApp.MainTab.ToolBars.RemoveAt(rowIndex - 1); KbBimstoreApp.MainTab.ToolBars.Insert(rowIndex, toolBar); } } }
public static KbBimstoreToolbar CreateDefaultToolbar() { KbBimstoreToolbar toolbar = new KbBimstoreToolbar(); toolbar.Name = "Default"; toolbar.Enabled = true; toolbar.TabIdentity = 0; return(toolbar); }
private static void CreateDefaultTabSettings(string path) { KbBimstoreTab defaultTab = new KbBimstoreTab(); defaultTab.Name = defaultTabName; defaultTab.Locked = false; defaultTab.Enabled = true; defaultTab.ToolBars = new List <KbBimstoreToolbar>(); for (int i = 0; i < defaultPanels.Length; i++) { string panel = defaultPanels[i]; KbBimstoreToolbar toolbar = new KbBimstoreToolbar(); toolbar.Name = panel; toolbar.Enabled = true; toolbar.TabIdentity = i; defaultTab.ToolBars.Add(toolbar); } File.WriteAllText(path, GetSettingsXML(defaultTab)); }