private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { switch (e.Node.ImageIndex) { case 1: ModViewer = new CMDLViewer(mod, (CMDL)e.Node.Tag) { Dock = DockStyle.Fill }; ModViewer.Width = panel1.Width; ModViewer.Height = panel1.Height; panel1.SuspendLayout(); panel1.Controls.Add(ModViewer); if (panel1.Controls.Count > 1) { panel1.Controls.RemoveAt(0); } panel1.Invalidate(); panel1.ResumeLayout(); ModViewer.Invalidate(); ModViewer.Render(); ModViewer.Render(); break; case 3: ModViewer = null; panel1.SuspendLayout(); panel1.Controls.Add(new TXOBViewer((ImageTextureCtr)e.Node.Tag) { Dock = DockStyle.Fill, Width = panel1.Width, Height = panel1.Height }); if (panel1.Controls.Count > 1) { panel1.Controls.RemoveAt(0); } panel1.Invalidate(); panel1.ResumeLayout(); break; default: ModViewer = null; panel1.SuspendLayout(); panel1.Controls.Clear(); panel1.Invalidate(); panel1.ResumeLayout(); break; } }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { switch (e.Node.ImageIndex) { case 1: ModViewer = new CMDLViewer(mod, (CMDL)e.Node.Tag) { Dock = DockStyle.Fill }; ModViewer.Width = panel1.Width; ModViewer.Height = panel1.Height; panel1.SuspendLayout(); panel1.Controls.Add(ModViewer); if (panel1.Controls.Count > 1) panel1.Controls.RemoveAt(0); panel1.Invalidate(); panel1.ResumeLayout(); ModViewer.Invalidate(); ModViewer.Render(); ModViewer.Render(); break; case 3: ModViewer = null; panel1.SuspendLayout(); panel1.Controls.Add(new TXOBViewer((ImageTextureCtr)e.Node.Tag) { Dock = DockStyle.Fill, Width = panel1.Width, Height = panel1.Height }); if (panel1.Controls.Count > 1) panel1.Controls.RemoveAt(0); panel1.Invalidate(); panel1.ResumeLayout(); break; default: ModViewer = null; panel1.SuspendLayout(); panel1.Controls.Clear(); panel1.Invalidate(); panel1.ResumeLayout(); break; } }