public void PopulatePanels() { BasePanel.AutoScrollPosition = new Point(0, 0); BasePanel.VerticalScroll.Value = 0; BasePanel.SuspendLayout(); TexturePanels.Clear(); foreach (Texture tex in Textures) { T2TP tp = new T2TP(this, tex); tp.Location = new Point(tp.Location.X, tp.Location.Y + ((tp.Height + 10) * TexturePanels.Count)); TexturePanels.Add(tp); } BasePanel.Controls.Clear(); BasePanel.Controls.AddRange(TexturePanels.ToArray()); BasePanel_Resize(this, EventArgs.Empty); BasePanel.ResumeLayout(); }
public void TPChange(T2TP TP, bool InvokeSelectionChanged = true) { if (SelectedPanel != null && SelectedPanel != TP && SelectedPanel.selected == true) { SelectedPanel.ChangeSelection(); } else if (SelectedPanel != null && SelectedPanel == TP && SelectedPanel.selected == true) { SelectedPanel.ChangeSelection(); SelectedPanel = null; return; } if (TP != null) { SelectedPanel = TP; if (InvokeSelectionChanged) { SelectedIndexChanged.Invoke((SelectedPanel == null) ? -1 : TexturePanels.IndexOf(SelectedPanel)); } TP.ChangeSelection(); } }