void treeView1_NodeMouseDoubleClick(object sender, System.Windows.Forms.TreeNodeMouseClickEventArgs e) { foreach (TabPage tb in this.mainTabControl.Controls) { if (tb.Text == e.Node.Name) { this.mainTabControl.SelectedTab = tb; return; } } for (int i = 0; i < this.LayerArrayList.Count; i++) { if (e.Node.Name != ((EPControl.Layer) this.LayerArrayList[i]).PaperName) { continue; } EPControl.Layer temp; temp = (EPControl.Layer) this.LayerArrayList[i]; System.Windows.Forms.TabPage newtabpage = new System.Windows.Forms.TabPage(); newtabpage.Text = temp.PaperName; newtabpage.Name = temp.PaperName; this.mainTabControl.Controls.Add(newtabpage); newtabpage.Controls.Add(temp); this.currentPaper = temp; this.mainTabControl.SelectedTab = newtabpage; break; } }
//当选项卡发生变化时 void mainTabControl_Selected(object sender, TabControlEventArgs e) { if (this.mainTabControl.SelectedTab.Text == this.CurrentStage.PaperName) { this.currentPaper = this.CurrentStage; this.currentPaper.RePaint(); } else { for (int i = 0; i < this.LayerArrayList.Count; i++) { if (this.mainTabControl.SelectedTab.Text == ((EasyPhoto.EPControl.Layer) this.LayerArrayList[i]).PaperName) { this.currentPaper = (EasyPhoto.EPControl.Layer) this.LayerArrayList[i]; this.currentPaper.RePaint(); break; } } } foreach (ToolStripButton tsbutton in this.mainToolStrip.Items) { tsbutton.CheckState = CheckState.Unchecked; } this.toolSelected = ToolSelected.None; this.initializeToolSelected(); this.CheckLayerInformaiton(); }
private void MainForm_Load(object sender, EventArgs e) { EasyPhoto.FileInfo fileinfo = new FileInfo(".hdk", Application.StartupPath + @"\EasyPhoto.ico", "EasyPhoto文件", Application.StartupPath + @"\EasyPhoto.exe"); EasyPhoto.FileTypeRegister.RegisterFileType(fileinfo); if (MainForm.DefaultPath != "") { string temp = (string)MainForm.DefaultPath.Clone(); MainForm.DefaultPath = ""; this.LoadFile(temp); return; } this.mainTabControl.Visible = false; this.DrawClientWidth = this.ClientSize.Width - this.mainToolStrip.Width - this.imageTabControl.Width - 8; this.DrawClientHeight = this.ClientSize.Height - this.mainMenuStrip.Height - this.mainStatusStrip.Height - 5; //工具栏各工具的初始化 this.mainTabControl.Visible = false; this.treeView1.Visible = false; this.CurrentPen = new Pen(new SolidBrush(Color.Black)); this.TempPen = (Pen)this.CurrentPen.Clone(); TempPen.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDot; this.CurrentBrush = new SolidBrush(Color.Black); this.UpdateFont(new FontFamily("宋体"), 12, FontStyle.Regular); this.toolSelected = ToolSelected.None; this.currentMouseDownPosition = new Point(); this.currentgraphics = null; this.BrushRadius = 1; this.IsMouseClick = false; this.IsMouseDown = false; this.IsCopyCell = false; this.IsCopyLayer = false; this.TempCell = null; this.TempLayer = null; this.Zoom = 1; defaultTabPageName = "图层"; currentPaper = null; defaultTabPageNum = 0; this.paperName = ""; this.CurrentStage = null; this.LayerArrayList.Clear(); this.tempArrayList.Clear(); this.finalArrayList.Clear(); try { HandCursor = new Cursor(Application.StartupPath + @"\Resources\Hand.cur"); PencilCursor = new Cursor(Application.StartupPath + @"\Resources\Pencil.cur"); MagnifierCursor = new Cursor(Application.StartupPath + @"\Resources\Magnifier.cur"); EraserCursor = new Cursor(Application.StartupPath + @"\Resources\Eraser.cur"); BrushCursor = new Cursor(Application.StartupPath + @"\Resources\Brush.cur"); } catch (Exception e1) { MessageBox.Show(e1.Message, "图标加载失败"); HandCursor = Cursors.Default; PencilCursor = Cursors.Default; MagnifierCursor = Cursors.Default; EraserCursor = Cursors.Default; BrushCursor = Cursors.Default; } this.CheckLayerInformaiton(); }