private void ChangeClickBrick(object sender, EventArgs e) { Brick brick = sender as Brick; if (brick.Value.Equals("Main")) { PSTab.SelectedTabPageIndex = 0; return; } int i = brick.Value.Equals(0) ? 1 : 0; brick.Value = i; ((ImageBrick)brick).Image = imageList1.Images[i]; pc.InvalidateBrick(brick); string tpName = "Orders[" + brick.ID + "]"; if (i == 1) { XtraTabPage tp = new XtraTabPage(); tp.Text = tpName; tp.Tag = brick.ID; PSTab.TabPages.Add(tp); PrintingSystem ps = new PrintingSystem(); ps.SetCommandVisibility(PrintingSystemCommand.ClosePreview, CommandVisibility.None); MyPrintControl pcNew = new MyPrintControl(); pcNew.ChangeClickBrick += new EventHandler(ChangeClickBrick); pcNew.Dock = DockStyle.Fill; pcNew.PrintingSystem = ps; tp.Controls.Add((System.Windows.Forms.Control)pcNew); PSTab.SelectedTabPageIndex = FindTabPageIndex(tpName, PSTab); //this.Focus(); } else { PSTab.TabPages.RemoveAt(FindTabPageIndex(tpName, PSTab)); PSTab.SelectedTabPageIndex = 0; } }
private void ChangeClickBrick(object sender, EventArgs e) { Brick brick = sender as Brick; if(brick.Value.Equals("Main")) { PSTab.SelectedTabPageIndex = 0; return; } int i = brick.Value.Equals(0) ? 1 : 0; brick.Value = i; ((ImageBrick)brick).Image = imageList1.Images[i]; pc.InvalidateBrick(brick); string tpName = "Orders[" + brick.ID + "]"; if(i == 1) { XtraTabPage tp = new XtraTabPage(); tp.Text = tpName; tp.Tag = brick.ID; PSTab.TabPages.Add(tp); PrintingSystem ps = new PrintingSystem(); ps.SetCommandVisibility(PrintingSystemCommand.ClosePreview, CommandVisibility.None); MyPrintControl pcNew = new MyPrintControl(); pcNew.ChangeClickBrick += new EventHandler(ChangeClickBrick); pcNew.Dock = DockStyle.Fill; pcNew.PrintingSystem = ps; tp.Controls.Add((System.Windows.Forms.Control)pcNew); PSTab.SelectedTabPageIndex = FindTabPageIndex(tpName, PSTab); //this.Focus(); } else { PSTab.TabPages.RemoveAt(FindTabPageIndex(tpName, PSTab)); PSTab.SelectedTabPageIndex = 0; } }