public GumpViewer(GumpViewer parent) { items=new ArrayList(); this._parent=parent; this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true); InitializeComponent(); }
private void miAddPage_Click(object sender, System.EventArgs e) { TabPage tp = new TabPage("Page " + tabControl1.TabPages.Count); GumpViewer gv = new GumpViewer(((GumpViewer)tabControl1.TabPages[0].Controls[0])); gv.Dock = DockStyle.None; tp.Controls.Add(gv); tp.BorderStyle = tabPage1.BorderStyle; tp.BackColor = tabPage1.BackColor; tp.AutoScroll = tabPage1.AutoScroll; gv.Size = gumpViewer1.Size; gv.SelectedGumpChanged += new selectedGumpChanged(gumpViewer1_SelectedGumpChanged); gv.SelectedIndexChanged += new selectedIndexChanged(gumpViewer1_SelectedIndexChanged); gv.GumpAdded += new gumpAdded(gumpViewer1_GumpAdded); gv.GumpRemoved += new gumpRemoved(gumpViewer1_GumpRemoved); gv.GumpChanged += new gumpChanged(gumpViewer1_GumpChanged); gv.GumpsSort += new gumpsSort(gumpViewer1_GumpsSort); gv.ContextMenu = cmTabMenu; this.tabControl1.TabPages.Add(tp); }
private void deserializeGumps(string path) { try { TextReader tr = new StreamReader(path); XmlSerializer xs = new XmlSerializer(typeof(Gump[][])); Gump[][] gmps=(Gump[][])xs.Deserialize(tr); tabControl1.TabPages.Clear(); TabPage tp; GumpViewer gv; for (int i=0; i<gmps.Length; i++) { tp = new TabPage("Page "+i); if(i!=0) gv = new GumpViewer(((GumpViewer)tabControl1.TabPages[0].Controls[0])); else gv = new GumpViewer(); gv.Gumps = gmps[i]; gv.Dock=DockStyle.Fill; tp.Controls.Add(gv); gv.SelectedGumpChanged+=new selectedGumpChanged(gumpViewer1_SelectedGumpChanged); gv.SelectedIndexChanged+=new selectedIndexChanged(gumpViewer1_SelectedIndexChanged); gv.GumpAdded+=new gumpAdded(gumpViewer1_GumpAdded); gv.GumpRemoved+=new gumpRemoved(gumpViewer1_GumpRemoved); gv.GumpChanged+=new gumpChanged(gumpViewer1_GumpChanged); gv.GumpsSort+=new gumpsSort(gumpViewer1_GumpsSort); gv.ContextMenu=cmTabMenu; this.tabControl1.TabPages.Add(tp); } tr.Close(); } catch(Exception exc) { MessageBox.Show(this, "Error reading file:\n"+exc,"Error",MessageBoxButtons.OK,MessageBoxIcon.Error); } }